Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • Great solution. Thanks. I had to do it this way right after replacing a flatDir declaration by a sourceSet jniLibs.srcDir otherwise it would not compile a release build. Commented Jan 25, 2024 at 18:36
  • This is not a good solution because it will unnecessarily expose app-module to some-lib.aar even if app-module does not have any dependency on some-lib.aar. library-module is the module that has a dependency on some-lib.aar, so the answer provided by @Jarrod Robins is the correct one. Commented Aug 17, 2024 at 15:55
  • But according to android offical doc: Note: You can't use the compileOnly configuration with Android Archive (AAR) dependencies. from developer.android.com/build/… Commented Aug 20, 2024 at 5:55
  • This solution is brittle; it could cause your app to crash at runtime if the implementation is removed or forgotten. However, the other solutions didn't work for me, so thanks for this work-around! Commented Nov 20, 2024 at 20:45