Skip to content

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

Description

@wilsolutions

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

Activity

  1. florindum commented on Feb 12, 2022

    @florindum

    @wilsolutions did you find any solution?

  2. jiroscripts commented on Mar 8, 2022

    @jiroscripts

    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'
      }
    
  3. abraini-Nascent commented on May 20, 2022

    @abraini-Nascent

    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?

  4. a-eid commented on Aug 28, 2022

    @a-eid

    did you guys find a workaround ?

  5. cristiano-linvix commented on Oct 25, 2022

    @cristiano-linvix

    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?

  6. DaisukiTamago commented on Nov 16, 2022

    @DaisukiTamago

    this stackoverflow answer solved the problem for me: https://stackoverflow.com/a/73699520/10933691

  7. Dhruv2110 commented on Dec 29, 2022

    @Dhruv2110

    Found the solution. Instead of ./gradlew assembleRelease try ./gradlew app:assembleRelease. Now APK build is working fine even with ./gradlew assembleRelease.

  8. locked and limited conversation to collaborators on Jan 1, 2023
  9. converted this issue into a discussion #346 on Jan 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions