Here is my grade.build file And this is error:
Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
com/google/android/gms/common/api/zza.class
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {`
compileSdkVersion 25
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "romasakhalid.css"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions
{
preDexLibraries = false
}
}
dependencies {`
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-v4'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.google.firebase:firebase-core:9.0.0'
compile 'com.google.firebase:firebase-database:9.0.0'
compile 'com.firebaseui:firebase-ui-database:0.6.2'
compile 'com.android.support:recyclerview-v7:25.3.1'
testCompile 'junit:junit:4.12'
You are probably using the wrong version of firebase-ui-database. According to the github page it has fixed dependencies on the com.google.firebase versions. This means you have to be sure that com.firebaseui:firebase-ui-database:0.6.2 supports com.google.firebase:firebase-core:9.0.0.
You can check it with the gradle dependency tree or you use one of the pre defined suggestions from the developer e.g.
FirebaseUI Version Firebase/Play Services Version
2.2.0 11.0.4
2.1.1 11.0.2
2.0.1 11.0.1
1.2.0 10.2.0
1.1.1 10.0.0 or 10.0.1
1.0.1 10.0.0 or 10.0.1
1.0.0 9.8.0
Related
Here is my gradle.build (app)... My app is not supporting devices of Android version 4.4.4 or less. My 1st version was supporting all the devices but after I updated my SDK and Google Play Services, it's not supporting 4.4.4 or less. Previously my firebase version here was 9.0.0 but now I have changed it to 11.0.1 because firebase analytics was not working on it.
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias 'CSSkey'
keyPassword 'romasa123'
storeFile file('C:/Users/Romasa Khalid/AndroidStudioProjects/CSS.jks')
storePassword 'romasa123'
}
}
compileSdkVersion 25
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "romasakhalid.css"
minSdkVersion 14
targetSdkVersion 25
versionCode 3
versionName "1.1.1"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
dexOptions {
preDexLibraries = false
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',{
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-v4'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:mediarouter-v7:25.3.1'
compile 'com.android.support:palette-v7:25.3.1'
compile 'com.google.android.gms:play-services-analytics:11.0.1'
compile 'com.google.firebase:firebase-ads:11.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.google.firebase:firebase-core:11.0.1'
compile 'com.google.firebase:firebase-database:11.0.1'
compile 'com.firebaseui:firebase-ui-database:2.0.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
}
I am making an app in which can edit photos and videos.It also shares edited photos via timeline which is made using Recycler view and Card view.
I am having an error whenever I try to run my app in Android SDK 22 but it is working file in Android SDK 23 and above.
Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/iid/zzc.class
It occurs also I am building apk.
Gradle File for my app
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "com.practice.android.moments"
minSdkVersion 18
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [appPackageName: "${applicationId}"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
jumboMode true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
/* 3)(Creative SDK) Exclude duplicate licenses */
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
//help
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES'
pickFirst 'AndroidManifest.xml'
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.google.android.gms:play-services-auth:11.0.1'
compile 'com.google.firebase:firebase-core:11.0.1'
compile 'com.google.firebase:firebase-messaging:11.0.1'
compile 'com.google.firebase:firebase-auth:11.0.1'
compile 'com.google.firebase:firebase-database:11.0.1'
compile 'com.google.firebase:firebase-storage:11.0.1'
compile 'com.google.firebase:firebase-ads:11.0.1'
compile 'com.google.firebase:firebase-invites:11.0.1'
compile 'com.google.firebase:firebase-appindexing:11.0.1'
compile 'com.google.firebase:firebase-crash:11.0.1'
compile ('com.facebook.android:audience-network-sdk:4.11.0'){
exclude group: 'com.google.android.gms'
}
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.adobe.creativesdk.foundation:auth:0.9.1251'
compile 'com.adobe.creativesdk:image:4.8.4'
compile 'com.localytics.android:library:3.8.0'
testCompile 'junit:junit:4.12'}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'}
apply plugin: 'com.google.gms.google-services'
Can any one please help me...
Phone used for testing
Meizu M2 Note OS version 5.1 Lollipop API 22
Redmi Note 3 OS version 6.0.1 Marshmallow API 23
Samsung Note 5 OS version 7.0 Nougat API 24
In my case,this error occurs because I have two different version of google-play-service lib.
I remove one of them,bingo!
Try move this compile
compile 'com.google.android.gms:play-services-auth:11.0.1'
I can run my application on devices using USB, But when i tried to build APK it's measure this error :
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/http/HttpHeaders.class
my gradle :
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "elryad.harajsooq"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled = true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.2.3'
compile group: 'org.apache.httpcomponents', name: 'httpclient-android', version: '4.3.5'
// compile 'org.apache.httpcomponents:httpcore:4.4.1'
// compile 'org.apache.httpcomponents:httpclient:4.5'
// compile 'org.apache.httpcomponents:httpmime:4.2.3'
compile files('libs/volley.jar')
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'com.android.support:support-annotations:25.3.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.support:palette-v7:25.3.0'
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.android.support:cardview-v7:25.3.0'
compile 'com.squareup.okhttp3:okhttp:3.1.2'
//compile 'com.android.support:support-v7:25.0.2'
compile "com.android.support:support-core-utils:25.3.0"
compile 'com.android.support:support-v13:25.3.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.google.firebase:firebase-messaging:9.0.0'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
}
Legacy Apache HTTP
You're bundling a version of Apache HTTP with your app. Remove this line from all modules' build.gradle:
useLibrary 'org.apache.http.legacy'
Behind the scenes that method actually includes a JAR of an old version of Apache HTTP which is not what you want if you're managing dependencies through Gradle/maven.
Matching versions
All imported artifacts from Apache HTTP have to have the same version.
compile 'org.apache.httpcomponents:httpmime:4.5.3'
compile 'org.apache.httpcomponents:httpclient-android:4.5.3'
Well, httpcore does not follow this sheme, then again consider it an internal transitive dependency, appropriate version is pulled automatically by whatever version of httpclient you use. You don't have to specify it manually.
List of Apache HTTP artifacts in maven: https://mvnrepository.com/artifact/org.apache.httpcomponents
My error is :
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
Failed to create MD5 hash for file 'D:\Android\AsianNEws\PNRstatus\app\libs\httpclient-4.3.6.jar'.
My Gradle file is :
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.example.hp_pc.pnrstatus"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
packagingOptions{
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/httpclient-4.3.6.jar')
compile files('libs/httpcore-4.3.3.jar')
compile files('libs/httpmime-4.3.6.jar')
// compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support.constraint:constraint-layout:+'
// compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
testCompile 'junit:junit:4.12'
}
In my case, I got the same Error Because of Spell Mistake in
compile files('lib/httpclient-4.3.6.jar') and solved by correcting the spelling to libs
Please Check the Spellings Correctly Or You may try this
compile files('libs/httpclient-4.3.6.jar','libs/httpcore-4.3.3.jar','libs/httpmime-4.3.6.jar')
PS: HttpClient was Deprecated One and Not Recommended. Please Consider OkHttp for future Projects
I too had the same problem.just changed libs to lib and it worked.
Check the spells correctly.
Errors log are below:
Error:Execution failed for task
':app:transformResourcesWithMergeJavaResForDebug'.
com.android.build.api.transform.TransformException:
com.android.builder.packaging.DuplicateFileException: Duplicate files
copied in APK META-INF/LICENSE File1:
C:\Users\MYPC.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpmime\4.5\7bdb321e86724b16af6134a0fd22fec649eda971\httpmime-4.5.jar
File2:
C:\Users\MYPC.gradle\caches\modules-2\files-2.1\xerces\xercesImpl\2.11.0\9bb329db1cfc4e22462c9d6b43a8432f5850e92c\xercesImpl-2.11.0.jar
File3:
C:\Users\MYPC.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.6.0\a0990e2e812ac6639b6ce955c91b13228500476e\jackson-annotations-2.6.0.jar
Dependencies I'm using below:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.example.xyz.testauto"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
testOptions {
unitTests.returnDefaultValues = true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'junit:junit:4.12'
compile 'io.appium:java-client:3.3.0'
compile 'com.googlecode.json-simple:json-simple:1.1.1'
compile 'commons-lang:commons-lang:2.6'
compile 'com.google.code.gson:gson:2.5'
compile 'com.testdroid:testdroid-api:2.9'
testCompile 'org.mockito:mockito-core:1.10.19'
compile 'com.google.dagger:dagger:2.4'
annotationProcessor 'com.google.dagger:dagger-compiler:2.4'
configurations {
all*.exclude group: 'commons-logging', module: 'commons-logging'
}
}
How I can remove this error ?
You should add this in your build.gradle section
META-INF directory are recognized and interpreted by the Java 2
Platform to configure applications, extensions;
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
Then Clean-Rebuild-Run