react-native-builder-bob
react-native-builder-bob copied to clipboard
Direct local .aar file dependencies are not supported when building an AAR.
Hi, please, I've create a react native module that includes 2 external libraries (.aar).
It builds fine, but when I ran npx react-native run-android example --deviceId=the_device
it returns the following error:
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).
I'm including the .aar in the build.gradle:
implementation files('lovely/cutelib.aar')
And then in the settings.gradle i do:
include ':cutelib'
Note: it will run fine into Android device if I don't pass the --deviceId flag :P
Any thoughts? ty
@wilsolutions did you find any solution?
Hello @wilsolutions, @florindumitru
Are you using "aar" in package.json > react-native-builder-bob > targets ?
I'm actually able to embed 3 aar by removing this target option.
My aar(s) are inside a libs
folder into the android
folder
Then in my android/build.gradle
I have:
dependencies {
implementation fileTree(dir: "libs", include: ["*.aar"])
}
Also my Android Gradle Plugin Version is in 4.2.1: (I don't know if it makes any difference)
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
}
Hello, the issue is still present even when setting the gradle version to 4.2.1.
It will work for debug builds however release builds of apps using RN > 0.64 that use our modules will fail with:
[RUN_GRADLEW] Execution failed for task ':rnModule:bundleReleaseLocalLintAar'.
[RUN_GRADLEW] > Error while evaluating property 'hasLocalAarDeps' of task ':rnModule:bundleReleaseLocalLintAar'
with the same description @wilsolutions posted.
Does anyone have a solution that will work for the new React Native versions?
did you guys find a workaround ?
Hello, the issue is still present even when setting the gradle version to 4.2.1.
It will work for debug builds however release builds of apps using RN > 0.64 that use our modules will fail with:
[RUN_GRADLEW] Execution failed for task ':rnModule:bundleReleaseLocalLintAar'. [RUN_GRADLEW] > Error while evaluating property 'hasLocalAarDeps' of task ':rnModule:bundleReleaseLocalLintAar'
with the same description @wilsolutions posted.
Does anyone have a solution that will work for the new React Native versions?
Any solution?
this stackoverflow answer solved the problem for me: https://stackoverflow.com/a/73699520/10933691
Found the solution. Instead of ./gradlew assembleRelease
try ./gradlew app:assembleRelease
. Now APK build is working fine even with ./gradlew assembleRelease
.