Android Studio: resolving duplicate classes

When I try to run runmy Android application on an Android device, the gradle console reports the following error:

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/loopj/android/http/AsyncHttpClient$1.class

When I look for the "AsyncHttpClient" class, I see that it really is in two different places:

/Users/Afflatus/.gradle/caches/modules-2/files-2.1/com.loopj.android/android-async-http/1.4.9/5d171c3cd5343e5997f974561abed21442273fd1/android-async-http-1.4.9-sources.jar!/com/loopj/android/http/AsyncHttpClient.java

/Users/Afflatus/.ideaLibSources/android-async-http-1.4.9-sources.jar!/com/loopj/android/http/AsyncHttpClient.java

The first path seems to offer him a "cache file" ... so I tried invalidating & restarting my cache, but both files still exist after gradle is restored and I will try the runapplication. I read in alternative messages that it can be eliminated by deleting one of the files ... Therefore, I went to the cache folder and deleted all the files found in the "1.4.9" folder ... unfortunately, after reopening Android Studio a new one is created cache file and I get the same error.

Other posts ( here , here , here and here ), suggest that if I add "./gradlew clean" to the root directory, it will restore gradle again just to run (as far as I understand). So I also tried to do this:

enter image description here

What made my application folder look like this:

enter image description here

But, unfortunately, this did not help, I still get the same error. What am I doing wrong? What should I do?

+4
source share
2 answers

sensorocloud.jar compile 'com.loopj.android:android-async-http:1.4.9' gradle, , . SDK loopj async-http.

, .class jar. (..

  • jar zip
  • com.loopj.android .class)

(PS , , jar gradle, , , SO post)

+1

- , libs, , libs. .

- gradle.build, libs.

, , APK.

,

0

All Articles