19

I found this warning after upgrading the latest android studio stable version

Error:Could not resolve all files for configuration ':app:xxxxxxxDebugCompileClasspath'.

Failed to transform file 'commons-lang-2.4.jar' to match attributes {artifactType=android-classes} using transform JarTransform Transform output file xxxxxxx/xxxxxxx/xxxxxxx/app/commons-lang-2.4.jar does not exist.

here is gradle and gradle wrapper versions :

gradle : classpath 'com.android.tools.build:gradle:3.0.0'

and

gradle wrapper :

distributionUrl=https\://services.gradle.org/distributions/g‌​radle-4.1-all.zip

Nawrez
  • 3,314
  • 8
  • 28
  • 42
  • what's the gradle plugin version and the gradle wrapper version ?? – Fakher Oct 26 '17 at 11:13
  • gradle : classpath 'com.android.tools.build:gradle:3.0.0' gradle wrapper : distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip – Nawrez Oct 26 '17 at 11:15
  • 1
    could you post your gradle file. for both module and project level – Fakher Oct 26 '17 at 11:16
  • Possible duplicate of [Android Studio 3.0 Compile Issue (Cannot choose between Configurations)](https://stackoverflow.com/questions/45679847/android-studio-3-0-compile-issue-cannot-choose-between-configurations) –  Nov 04 '17 at 11:47

4 Answers4

12

change dependency declaration

from

compile files('libs/commons-lang-2.4.jar')

to

implementation files('libs/commons-lang-2.4.jar')

Nawrez
  • 3,314
  • 8
  • 28
  • 42
scionoftech
  • 608
  • 2
  • 9
  • 24
  • @Kenji can you explain it better : I think it is another case – Nawrez Nov 09 '17 at 09:55
  • For me, the jar file was built from NDK sources. It was solved by a combination of adding 'implementation' in place of 'compile', but also making sure that the paths to the jar file were correct in all cases. – Ken Corey Dec 06 '17 at 07:23
  • My case does not have dependencies complie files, but classpath instead – tngotran Apr 03 '19 at 08:48
7

I had the same problem, build -> clean project worked for me.

Audida
  • 124
  • 2
  • 12
3

Change the classpath of Project Gradle to:

 classpath 'com.android.tools.build:gradle:3.1.0-alpha01'

OR

change distributionUrl of gradle-wrapper.properties to

distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

Hope it helps you

Sandeep Manmode
  • 395
  • 4
  • 15
1

I had same problem , googled a lot but nothing worked. Following worked for me on Android 4.2.1

Go to File -> Manage IDE Settings -> Restore IDE Settings

Then follow the instructions.