Error: Unable to resolve dependency for compileClasspath using transform ExtractAarTransform
Asked Answered
P

3

6

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

Panacea answered 21/11, 2017 at 12:59 Comment(0)
D
9

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.

Deaf answered 14/3, 2018 at 9:58 Comment(1)
Oh my God! You saved me! ;) Great! Thank You a lot!!! But why this is not said in official guide!! :(Overcompensation
I
1

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.

Innsbruck answered 27/1, 2018 at 6:58 Comment(0)
M
0

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)

Maddocks answered 26/12, 2019 at 15:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.