0

In my Android application project I am trying to avoid referencing an external Maven repository in my project from where I would load multiple .aar artifacts which make up one SDK.

Instead, I would like to put the .aar files into my project and then reference them from one of my Gradle Android library modules.

I already tried different approaches - none worked, though.

Approach 1: Composite build (includeBuild)

  • Inspired by https://stackoverflow.com/a/72672032/35689
  • Here my artifact(s) cannot be resolved by Gradle.
  • I also tried this in isolation with the sample project - for some reason it does not work with my artifacts. In the example there is only one .aar file which might be the reason.

Approach 2: One module per aar

  • Inspired by https://stackoverflow.com/a/70074787/356895

  • Here I end up with this error:

    jetified-externallibrary-1.2.3/res/values/values.xml:113:5-122:13: AAPT: error: style attribute 'attr/shimmer_auto_start' not found.

JJD
  • 50,076
  • 60
  • 203
  • 339

1 Answers1

1

You have to manually add all of the .aar file's dependencies to your project in order to make this work. You will also have to substitute the maven dependency with the .aar file manually.

The reason is that an individual .aar file does not contain any metadata like maven coordinates, version, dependencies, etc. Therefore Gradle cannot handle any of this for you automatically.

Nelson Osacky
  • 599
  • 2
  • 12