-
Notifications
You must be signed in to change notification settings - Fork 0
Direct local .aar file dependencies are not supported when building an AAR.
Snoy-Kuo edited this page Mar 29, 2022
·
1 revision
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 :ocr project caused this error: /project_path/someModule/someLib.aar
When add a AAR file in a library module, you can debug and run App normally. But if you want to build release version. Uh-oh, building failed.
- macOS 12.2.1 (Monterey) x64
- Android Studio Bumblebee Patch 1
- Android SDK version 31
- Android Gradle Plugin: 7.0.4
- Gradle: 7.1.1
- Gradle JDK: 11
- Kotlin: 1.6.10
-
Error building Android library: Direct local .aar file dependencies are not supported
- create a module with a build.gradle and the AAR files.
=> Not work for me.
- create a module with a build.gradle and the AAR files.
-
完美解决Direct local .aar file dependencies are not supported when building an AAR.
- add local repositories setting in module's build.gradle.
=> Not work for me.
- add local repositories setting in module's build.gradle.
-
Android library 依赖 aar 包的两种方式
- add local repositories setting in module's build.gradle.
=> Not work for me. - create a module with a build.gradle and the AAR files.
=> It works!. The difference is the line ofimplementation project(':your_aar_module'), where it has noconfiguration = "default"parameter.
- add local repositories setting in module's build.gradle.
-
Android library 依赖 aar 包的两种方式
- create a module(eg. aars-module) with a build.gradle and the AAR files.
- add these lines to the build.gradle file:
configurations.maybeCreate("default") artifacts.add("default", file('someLib.aar')) - add
inclue ':aars-module'to the settings.gradle file. - add
api project(:aars-module)orimplementation project(:aars-module)to the build.gradle file of which module using the AAR files' feature.