star-micronics / react-native-star-io10

react-native-star-io10 is a library for supporting application development for Star Micronics devices.
Other
89 stars 55 forks source link

How to build apk with `:app:assembleRelease` #91

Open kickbk opened 1 year ago

kickbk commented 1 year ago

I need to build a development client apk to be installed on a device.

When building an apk with :app:assembleDebug, or when building an aab for production with :app:bundleRelease, it builds correctly.

It fails when building a apk development client that is to be installed on the phone (:app:assembleRelease). Is there a way to build this without running into Direct local .aar file dependencies are not supported when building an AAR?

I believe your proposed PR with compileOnly fix does not apply here. I tried it and it failed an apk with :app:assembleRelease

I should mention that on Expo, I can see Running 'gradlew :app:assembleRelease' in /home/expo/workingdir/build/apps/myApp/android, which is equivalent to your proposed solution here and here

bandit-ibayashi commented 1 year ago

@kickbk Thank you for your information. I am confirming this issue, so thank you for your patience.

bandit-ibayashi commented 1 year ago

I have confirmed that this does not fail for our sample SDK that do not have the compileOnly fix applied, with a build using./gradlew :app:assembleRelease command.

If I have made some misunderstanding, please let me know. If so, I would appreciate it if you would share your environmental information and expected behavior as well as the actual information as it is in the template.

Thank you!

ngaiyuekeung commented 1 year ago

Same problem, building APK with Android Studio

Executing tasks: [:app:assembleRelease, :app:assembleReleaseUnitTest] in project

full error message:

Direct local .aar file dependencies are not supported when building an AAR. The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR. Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error). The following direct local .aar file dependencies of the :react-native-star-io10 project caused this error

os version: macOS 13.3 (m1) Android Studio Electric Eel | 2022.1.1 Patch 1 jdk runtime version: 11.0.15+0-b2043.56-8887301 aarch64 active build variant: release

Also tried run ./gradlew :app:assembleRelease, same error

 * What went wrong:
  Execution failed for task ':react-native-star-io10:bundleReleaseLocalLintAar'.
   > Error while evaluating property 'hasLocalAarDeps' of task ':react-native-star-io10:bundleReleaseLocalLintAar'
    > Direct local .aar file dependencies are not supported when building an AAR. The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR. Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error). The following direct local .aar file dependencies of the :react-native-star-io10 project caused this error: /Users/Norris/Projects/chukmarket/dashboard/node_modules/react-native-star-io10/android/src/lib/stario10.aar

I am not sure this information is enough, please let me know if you need more information.

justduy commented 1 year ago

I also have the same issue when building the apk. @kickbk did you find a solution in the end? I have tried to build both with and without expo and have no luck in bulidling any apk.

@bandit-ibayashi did you run the building on mac or windows? I tried to extract the example to it own project and replaced the react-native-star-io10 version in package.json with "1.3.0". When I try to build, it fails as described above. It can run locally fine, but cannot assemble any apk.

Bolli17 commented 1 year ago

Any update on this @bandit-ibayashi ?

kfernandes29 commented 1 year ago

This is a known issue. Make the two changes here in the node_modules/react-native-star-io10 folder:

https://github.com/star-micronics/react-native-star-io10/pull/56/files