6
votes

For a helping lib I use, I recently get:

Error:Unable to resolve dependency for ':app@debug/compileClasspath': Failed to transform file 'mylib-release.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform

and then on gradle console:

Could not resolve all files for configuration ':demo:debugCompileClasspath'.

Failed to transform file 'mylib-release.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform java.io.FileNotFoundException: mylib-release.aar (Datei oder Verzeichnis nicht gefunden)

It was working last week, unfortunately I forgot what changed

3

3 Answers

9
votes

In my case it was the missing .aar file (or files, depending on how many buildtypes you have), as @JBTPublic pointed out.

So how did I fix it? Well, you need to generate it by yourself. At least for me, Android Studio doesn't generate it by itself. I had imported an Android library onto my project, and it was working perfectly well in a Linux environment. But I forgot that I needed to generate the AAR file before running my Android app.

To generate the AAR file, if you have an Android Library as a dependency for your project, you need to:

  1. Open the your-android-library/build.gradle
  2. In the Android Studio menu, go to Build -> Make Module 'your-android-library'

Once the Make is done (you'll see a Build SUCCESSFUL message), then you are all set up to Run your Android app as you normally do.

Hint: Add this info into your Readme file, in order for you not to forget once you change environment, like I did just last night before going for a trip.

1
votes

In my case this error was due to that .aar was missing so in your case check that your lib mylib-release.aar exists and is found in the debug compileClasspath.

0
votes

Well, you need to generate .AAR file by yourself.

go to root project folder -> your proj -> build -> outputs -> aar -> delete folder or content

go to gradle tools window (usually top right corner of android studio) and get execute task build

your proj-lib-aar -> your proj -> Tasks -> build (double click)