I tried to import the Eclipse Android working project into Android Studio. I am working on a Mac with the latest version of Android Studio. When I try to build, it keeps showing this error:
Error: execution completed for task ': Application: transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: COM / Google / API / client / HTTP / AbstractHttpContent.class
The class that creates this problem is in the com.google.http-client: google-http-client-gson: 1.20.0 library in the com.google.api.client.http package. I tried a lot of things with the app.gradle file, for example, excluding the com.google.api.client.http group, but nothing works. Here is my app.gradle file:
apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.2" useLibrary 'org.apache.http.legacy' defaultConfig { applicationId "com.example.time2" minSdkVersion 17 targetSdkVersion 19 multiDexEnabled true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } compileOptions.encoding = 'ISO-8859-1' } repositories { mavenCentral() } dependencies { compile 'com.android.support:support-v4:20.0.0' compile 'com.google.android.gms:play-services:+' compile 'com.google.http-client:google-http-client-gson:1.20.0' compile 'com.google.code.gson:gson:2.1' compile files('libs/commons-io-2.4.jar') compile files('libs/google-api-client-1.18.0-rc.jar') compile files('libs/google-api-client-android-1.18.0-rc.jar') compile files('libs/google-http-client-1.18.0-rc.jar') compile files('libs/google-http-client-android-1.18.0-rc.jar') compile files('libs/google-oauth-client-1.18.0-rc.jar') compile files('libs/httpcore-4.3.3.jar') compile files('libs/httpmime-4.3.6.jar') compile files('libs/json-simple-1.1.1.jar') compile files('libs/jsr305-1.3.9.jar') compile 'com.stripe:stripe-android:+' compile 'com.facebook.android:facebook-android-sdk:4.7.0' }
source share