1
votes

I use latest Android Studio 3.5 version (Android Gradle plugin 3.5.0). When I try to compile I receive this error:

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Failed to transform artifact 'lifecycle-viewmodel.aar (androidx.lifecycle:lifecycle-viewmodel:2.1.0)' to match attributes {artifactType=jar}. Show Details Affected Modules: app

ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Failed to transform artifact 'lifecycle-viewmodel.aar (androidx.lifecycle:lifecycle-viewmodel:2.1.0)' to match attributes {artifactType=jar}. Show Details Affected Modules: app

ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Failed to transform artifact 'lifecycle-viewmodel.aar (androidx.lifecycle:lifecycle-viewmodel:2.1.0)' to match attributes {artifactType=jar}. Show Details Affected Modules: app

3
Another thing to try if you get a similar error: try a different build variant; see stackoverflow.com/a/50483096/56285 - Jonik
got the same problem did you found a solution ? - Aqua Freshka

3 Answers

1
votes

Can you please share your build.gradle file ? Although I am not sure but it may works

Solution 1: Go to "File". Click on Invalidate Cache/ Restart. Again click on Invalidate Cache / Restart

Solution 2: Change

apply plugin: 'com.android.application' to apply plugin: 'com.android.library'

Solution 3: comment out one by one in dependencies and try to run

0
votes

Just rename your library or Copy your library name from refactor and paste it in build.gradle.

0
votes

In my case, updating gradle.properties worked.

Before:

org.gradle.jvmargs=-Xmx1536M

After:

org.gradle.jvmargs=-Xmx4096M