Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Unable to resolve dependency for compileClasspath using transform ExtractAarTransform

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

like image 636
Ralf Wickum Avatar asked Nov 21 '17 12:11

Ralf Wickum


2 Answers

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.

like image 127
xarlymg89 Avatar answered Oct 21 '22 20:10

xarlymg89


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.

like image 22
JBTPublic Avatar answered Oct 21 '22 21:10

JBTPublic