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.

Required fields*

10
  • 9
    Not sure how this answer ever helped anyone. Google states: "You can't use the compileOnly configuration with AAR dependencies." in their docs: developer.android.com/studio/build/dependencies Commented Mar 30, 2021 at 8:30
  • 1
    @DarkNeuron that's because the OP's use case is different: you have a library project that compiles to an aar which also depends on other aars. So for this case, compileOnly works with the caveats noted in my answer (i.e., you have to include the aar dependencies that are compile only in the project consuming the library) Commented Mar 30, 2021 at 23:33
  • 1
    What? No no, my use case was exactly the same: Was building a library that used an AAR. I posted the above because it did NOT work. Everything compiled, but the library was missing from the final bundle. Which left me confused until I saw that note by Google. In any case I solved my aar problem by extracting the jar file contained within. Which might not work for everyone. Commented Apr 1, 2021 at 11:17
  • 2
    @Żabojad then you didn't understand the above answer. You have to include the dependencies. Commented Feb 8, 2022 at 5:01
  • 1
    How to include the aar dependencies on the application project that consumes your library ? how to publish your aar dependencies to a maven repository ? @Luis Commented Sep 22, 2022 at 9:00