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.
Related
I decided to integrate appodeal into the application, did everything according to the instructions, but the result is still the same:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v7/widget/DefaultItemAnimator$7.class
I googled this question, but I still could not find a solution.
Here is gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.successdev.bookwindev.bookwin"
vectorDrawables.generatedDensities = ['hdpi', 'xxhdpi']
minSdkVersion 17
targetSdkVersion 25
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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 project(':caldroidcustom')
compile 'com.github.johnkil.android-robototextview:robototextview:3.0.0'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:palette-v7:25.3.1'
compile 'com.aurelhubert:ahbottomnavigation:1.1.8'
compile 'com.bignerdranch.android:expandablerecyclerview:3.0.0-RC1'
compile 'com.iceteck.silicompressorr:silicompressor:2.0'
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.6'
compile project(':cheetah-mobile-3.4.7')
compile 'com.google.android.gms:play-services:11.0.2'
compile 'com.google.android.gms:play-services-ads:11.0.2'
compile 'com.google.android.gms:play-services-location:11.0.2'
testCompile 'junit:junit:4.12'
}
P.S Sorry for my clumsy English =)
Add this to your app's build.gradle:
configurations.all {
resolutionStrategy {
force 'com.android.support:recyclerview-v7:25.3.1'
}
}
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
Please need your help...
this my app build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.wiimii"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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:appcompat-v7:23.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-core:9.2.1'
compile 'com.google.firebase:firebase-messaging:9.2.1'
testCompile 'junit:junit:4.12'
compile files('libs/httpcore-4.2.3.jar')
compile files('libs/httpclient-4.0.3.jar')
compile files('libs/httpmime-4.3.jar')
}
apply plugin: 'com.google.gms.google-services'
When i press on "build apk" i get this error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/http/annotation/Immutable.class
**Finally this the way I fix the problem:**
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.wiimii"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
//this I adding to fix the http... jar file
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
//necessary
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
}
dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
//also need this for deal with com.android.support.test
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-core:9.2.1'
compile 'com.google.firebase:firebase-messaging:9.2.1'
testCompile 'junit:junit:4.12'
compile files('libs/httpcore-4.3.3.jar')
compile files('libs/httpclient-4.3.6.jar')
compile files('libs/httpmime-4.3.6.jar')
//add this jar file manually to libs directory
compile files('libs/android-support-v4.jar')
}
apply plugin: 'com.google.gms.google-services'
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
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