Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Direct local .aar file dependencies are not supported when building an AAR. #5

Closed
habhabsafi opened this issue Jun 28, 2024 · 7 comments

Comments

@habhabsafi
Copy link
Contributor

habhabsafi commented Jun 28, 2024

I am using the Lib and following the installation instructions of installation.md in a react-native app.
environment information:

Gradle 7.6
Kotlin:       1.7.10
Groovy:       3.0.13
Ant:           1.10.11 
JVM:          17.0.10 
OS:           Mac OS X 13.5 x86_64
react-native 0.71.4
AGP         7.2.2

I am getting this Error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-maps-here:bundleReleaseLocalLintAar'.
> Error while evaluating property 'hasLocalAarDeps' of task ':react-native-maps-here: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-maps-here project caused this error: /Users/myuser/REPO/my-installer/android/app/libs/heresdk-explore-android-4.18.5.0.113335.aar
   * Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':react-native-maps-here:bundleReleaseLocalLintAar'.
Caused by: org.gradle.api.internal.tasks.properties.PropertyEvaluationException: Error while evaluating property 'hasLocalAarDeps' of task ':react-native-maps-here:bundleReleaseLocalLintAar'.

looks like setting an .aar file in libs isn't supported, although I am using the same AGP you're using in example.

@habhabsafi
Copy link
Contributor Author

habhabsafi commented Jun 28, 2024

I am doing this workaround for the same issue that I found here
brim-borium/spotify_sdk#99 (comment)
It works because I am no longer getting the error. however, I am now getting this other error

FAILURE: Build failed with an exception.

What went wrong:
Execution failed for task ':react-native-maps-here:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error.
...
 Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':react-native-maps-here:compileDebugKotlin'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:142)
        at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:282)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:140)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:128)
...
Caused by: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
        at org.gradle.workers.internal.DefaultWorkerExecutor$WorkItemExecution.waitForCompletion(DefaultWorkerExecutor.java:348)
        at org.gradle.internal.work.DefaultAsyncWorkTracker.lambda$waitForItemsAndGatherFailures$2(DefaultAsyncWorkTracker.java:130)
        at org.gradle.internal.Factories$1.create(Factories.java:31)
        ...
                at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:49)
Caused by: org.gradle.api.GradleException: Compilation error.
...

I also upgraded gradle to 8.0.1 because you're using it in example still same problem

@habhabsafi
Copy link
Contributor Author

habhabsafi commented Jun 30, 2024

i also installed and ran the example directory from your repo, and I am getting the same error as the original error in my repo

Execution failed for task ':react-native-maps-here:bundleDebugAar'.
> Error while evaluating property 'hasLocalAarDeps' of task ':react-native-maps-here:bundleDebugAar'.
   > 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-maps-here project caused this error: /Users/shabhab/Downloads/react-native-maps-here-main/example/android/app/libs/heresdk-explore-android-4.18.5.0.113335.aar

@ajakka
Copy link
Owner

ajakka commented Jul 1, 2024

Hi @habhabsafi, does this issue occur when your developing or when your trying to make a signed aar/apk ?

If so do you have other libraries installed like react-native-vision-camera or react-native-gesture-handler ?

@habhabsafi
Copy link
Contributor Author

habhabsafi commented Jul 2, 2024

react-native-vision-camera

well, it's happening when i do ./gradlew build while developing.
yes I do have other libraries, for instance I have react-native-camera, reactive-native-qrcode-scanner and many more.
On top of that, and as per my last comment, I tried to run ./gradlew build on your example directory and it threw the same error

@ajakka
Copy link
Owner

ajakka commented Jul 2, 2024

Ok I'm exploring it now, the problem seems to be that .aar libraries can't be bundled correctly with the app builds.

@ajakka
Copy link
Owner

ajakka commented Jul 3, 2024

@habhabsafi I published a new version: v1.1.0 that aims to fix this issue, but you will need to make some changes on your part:

  1. change the libs folder name to: heresdk and move it outside of the app folder.
    Meaning your library should be in android/heresdk/heresdk-explore-android-x.x.x.x.x.aar instead of android/app/libs/heresdk-explore-android-x.x.x.x.x.aar

  2. in your android/app/build.gradle replace the implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar']) with implementation fileTree(dir: file("../heresdk"), include: ['*.aar'])

If all goes well, you should build successfully

@habhabsafi
Copy link
Contributor Author

the build worked, thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants