Is there a recommended way to add a dependency on ...
# multiplatform
t
Is there a recommended way to add a dependency on an .aar file for Android in the shared component? I tried putting it under libs, but I get this error:
Copy code
> 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 :common project caused this error:
m
Create an .aar module. Unfortunately the template has been removed from Android Studio. But you create a module where the build script declares that library as its artifact.
Copy code
configurations.maybeCreate("default")
artifacts.add("default", file('my_lib.aar'))
Then you depend on the project instead of the file.
👍🏻 1
👍 1
l
You can set the aar to compileOnly in the library, but keep in mind that the final consumer also needs to add the aar as implementation.
👍 1
2471 Views