I tried to build apk it comes out this. What should I do? Please help!!
I don't where is the problem. The project is fine when I build the project, but it come error when I build apk.
Error:Execution failed for
task':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class
Here is the gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
applicationId 'com.androidbelieve.SeeDate'
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
useLibrary 'org.apache.http.legacy'
multiDexEnabled true
}
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'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
productFlavors {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services-ads:10.0.1'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:cardview-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.mcxiaoke.volley:library:1.0.18'
compile 'com.github.bumptech.glide:glide:3.6.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.android.support:support-v4:22.2.1'
compile 'it.neokree:MaterialNavigationDrawer:1.3.3'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.code.findbugs:jsr305:2.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.firebase:firebase-client-android:2.5.0'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.firebaseui:firebase-ui:0.6.0'
}
apply plugin: 'com.google.gms.google-services'
gradle project
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Did you tried Build/Clean Project in Android Studio Menu
Which dependency does the app:transformClassesWithJarMergingForDebug come from? Maybe you should modify that dependency's version number to be consistent with the major sdk version.
Related
I'm new to android, so please bear with me if my question is stupid.
I have an android project built in older version of gradle. The app works fine when modifying code in existing activities, but whenever I create a new activity, I get the following error:
Error:(77, 13) Failed to resolve: com.android.support.constraint:constraint-layout:1.0.2
Upgrade plugin to version 3.0.1 and sync project
Show in File
Show in Project Structure dialog
This is the content of app level gradle file:
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias ''
keyPassword ''
storeFile file('')
storePassword ''
}
}
compileSdkVersion 27
buildToolsVersion "23.0.2"
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'
}
defaultConfig {
applicationId ""
minSdkVersion 15
targetSdkVersion 22
multiDexEnabled true
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
repositories {
jcenter()
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dexOptions {
incremental true
}
productFlavors {
}
}
dependencies {
//compile fileTree(include: ['*.jar'], dir: 'libs')
//Fast and simple data storage library for Android
// compile project(':squarecamera')
// compile 'com.github.boxme:squarecamera:1.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.amazonaws:aws-android-sdk-s3:2.2.6'
compile 'se.emilsjolander:stickylistheaders:2.7.0'
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'io.paperdb:paperdb:0.9'
compile 'com.fabiendevos:nanotasks:1.1.0'
compile 'com.flipboard:bottomsheet-core:1.5.0'
compile 'com.flipboard:bottomsheet-commons:1.5.0'
compile 'com.android.support:design:23.1.1'
compile 'com.squareup.okhttp:okhttp:1.6.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:1.6.0'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-jackson:2.0.0-beta2'
compile 'com.getbase:floatingactionbutton:1.10.1'
compile project(':squarecamera')
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
This is my project level gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
allprojects {
repositories {
jcenter()
}
}
And my android studio version is 3.0.1.
When I update the plugin, I get a lot of compatibility issues.
Please help me resolve this. Thanks in advance!
when i click on run button then i got this error
Error:org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
Error:org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.android.support:appcompat-v7:27.0.1.
please see below screen shot
and when i try to gradle sync
then i got this problem
please see below screen shot
my build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
signingConfigs {
config {
}
}
repositories {
mavenCentral()
}
compileSdkVersion 25
buildToolsVersion '26.0.0'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.hechat"
minSdkVersion 18
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "2048M"
}
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'
exclude 'project.properties'
exclude 'META-INF/INDEX.LIST'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven { url "https://dl.bintray.com/hani-momanii/maven" }
}
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.google.code.findbugs'
})
compile('com.twitter.sdk.android:twitter:2.3.1#aar') { transitive = true; }
compile('com.crashlytics.sdk.android:crashlytics:2.6.5#aar') { transitive = true; }
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.1'
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:cardview-v7:25.0.0'
compile 'com.android.support:design:25.0.0'
compile 'net.gotev:uploadservice:2.1'
compile 'com.android.support:recyclerview-v7:25.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'hani.momanii.supernova_emoji_library:supernova-emoji-library:0.0.2'
compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.code.gson:gson:2.3'
compile 'org.apache.httpcomponents:httpcore:4.3.2'
compile 'org.apache.httpcomponents:httpmime:4.3.3'
compile 'com.mcxiaoke.volley:library:1.0.17'
compile 'com.github.clans:fab:1.6.2'
compile 'org.jsoup:jsoup:1.8.1'
compile 'com.parse.bolts:bolts-tasks:1.4.0'
compile 'com.commit451:PhotoView:1.2.4'
compile 'com.android.support:multidex:1.0.0'
compile 'com.splitwise:tokenautocomplete:1.3.3'
compile 'com.tubb.smrv:swipemenu-recyclerview:5.2.1'
compile 'com.github.bumptech.glide:glide:3.5.2'
compile 'se.emilsjolander:stickylistheaders:2.7.0'
compile 'com.mindorks:placeholderview:0.6.4'
compile 'org.twitter4j:twitter4j-core:4.0.2'
compile 'jp.wasabeef:fresco-processors:2.1.0'
compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.3.0'
compile 'com.google.firebase:firebase-messaging:10.2.1'
compile 'com.android.billingclient:billing:1.0'
testCompile 'junit:junit:4.12'
compile project(':cometchat_platinum-sdk')
}
apply plugin: 'com.google.gms.google-services'
i have not used v-27 then why i am facing v7 issue
thanks in advance
Add allprojects block in your app level build file
1.
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}}}
2.
New projects created using Android Studio 3.0 and higher also include
allprojects {
repositories {
jcenter()
google()
}}
And change your compileSdkVersion to 26 and also buildToolsVersion "26.0.1" then sync your project
Hope this will help you.
Try this i have same problem i solved using below dependencies of Facebook
Use this
compile 'com.facebook.android:facebook-android-sdk:4.26.0'
instead of this
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
There are dependencies that require the entire hierarchy of modules to include the repository.
With Kotlin DSL
build.gradle.kts (Project)
allprojects {
repositories {
// ...
maven(url = "<YOUR-URL>")
}
}
With Groovy
build.gradle (Project)
allprojects {
repositories {
// ...
maven {
url '<YOUR-URL>'
}
}
}
GL
In my case, I was using old plugin so needed to add
jcenter()
After
mavenCentral()
This question already has an answer here:
Duplicate files copied in APK META-INF/maven/com.squareup/otto/pom.xml
(1 answer)
Closed 5 years ago.
Hello people i get the following error when iam trying to run my android app:
Gradle build error, 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/maven/com.squareup.okio/okio/pom.xml
These are my both gradle files:
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
apply plugin: 'maven'
maven { url 'https://maven.google.com' }
maven {url 'https://maven.fabric.io/public'}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And this is the other one:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.dp.liveupdatestatus"
minSdkVersion 18
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
// This is needed for firebase UI
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:customtabs:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.google.firebase:firebase-core:11.4.2'
compile 'com.google.firebase:firebase-database:11.4.2'
compile 'com.google.firebase:firebase-storage:11.4.2'
compile 'com.google.firebase:firebase-crash:11.4.2'
compile 'com.google.firebase:firebase-auth:11.4.2'
compile 'com.google.firebase:firebase-messaging:11.4.2'
compile 'com.firebaseui:firebase-ui:3.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
}
// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'
Please help!
android {
......
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'
}
}
add this to exclude the META inf files
I have a android studio project contains two modules use same library (jsoup). When i compie app it will show
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/maven/org.jsoup/jsoup/pom.xml File1:
C:\Users\G.gradle\caches\modules-2\files-2.1\org.jsoup\jsoup\1.8.2\64238922c4006c3d0a9951c4c03983ecc6a1e1a0\jsoup-1.8.2.jar
File2:
C:\Users\G\AndroidStudioProjects\twrb\app\build\intermediates\exploded-aar\twrb\webviewtimetablesearcher\unspecified\jars\classes.jar
The dependencies in build.gradle of two modules as show below.
dependencies {
compile 'org.jsoup:jsoup:1.8.2'
}
And this is build.gradle of app.
dependencies {
compile project(':moduleA')
compile project(':moduleB')
}
How to fix it?? Thanks.
This is my whole build.gradle of app
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.test.tmp"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
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'
exclude 'META-INF/maven/org.jsoup/jsoup/pom.xml'
exclude 'org/jsoup/nodes/entities-base.properties'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:3.2.4'
}
}
// Required because retrolambda is on maven central
repositories {
mavenCentral()
}
apply plugin: 'com.android.application' //or apply plugin: 'java'
apply plugin: 'me.tatarka.retrolambda'
dependencies {
compile 'com.android.support:support-v4:23.2.1'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'io.realm:realm-android:0.87.5'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'io.reactivex:rxandroid:1.1.0'
compile 'io.reactivex:rxjava:1.1.0'
compile 'com.jakewharton.rxbinding:rxbinding:0.4.0'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
testCompile 'junit:junit:4.12'
androidTestCompile 'junit:junit:4.12'
compile project(':moduleA')
compile project(':moduelB')
}
For resolve it you must add
android {
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
in build.gradle
I am working on one android application, where i am using two libraries ( Aviary android sdk and PrintIO sdk)
Getting conflict in libraries and getting this error each time when compiling project :
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: it/sephiroth/android/library/widget/AbsHListView$1.class
I have not used such library anywhere in my project as well as i also checked in both libraries, but not found anything.
Please anyone suggest me anything why i am getting this conflict in my project?
EDIT :
Here is my build.gradle file :
apply plugin: 'com.android.application'
repositories {
mavenCentral()
jcenter()
mavenLocal()
maven {
name 'maven.aviary.com'
url uri("http://maven.aviary.com/repo/release")
}
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
lintOptions {
disable 'MissingTranslation'
}
defaultConfig {
applicationId "XXXXX.XXXXX"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
renderscriptTargetApi 18
renderscriptSupportModeEnabled true
multiDexEnabled true
}
packagingOptions {
exclude 'lib/armeabi-v7a/librsjni.so'
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'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/httpclient-4.0.1.jar')
compile files('libs/httpcore-4.0.1.jar')
compile project(':MaterialDialog')
compile files('libs/universal-image-loader-1.9.1.jar')
compile project(':StaggeredGrid')
compile project(':CustomFloatingButtonLibrary')
compile files('libs/dropbox-android-sdk.jar')
compile files('libs/gcm.jar')
compile project(':image_select_lib')
compile files('libs/json-simple-1.1.1.jar')
compile project(':chipsLib')
compile files('libs/aws-android-sdk-1.4.3-s3.jar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.instabug.library:instabugsupport:1.+'
// compile 'com.aviary.android.feather.sdk:aviary-sdk:3.6.3'
compile 'com.yalantis:phoenix:1.2.3'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.google.android.gms:play-services-location:7.5.0'
compile project(':Aviary-SDK')
compile project(':SwipyLib')
compile project(':printio')
}
EDIT 2 :
I searched for library (AbsHListView) using CTRL + N and it result in following :
I did a google search for the class it/sephiroth/android/library/widget/AbsHListView$1.class and found out it is used by the library here.
Looks like one of your dependencies is using this library. If you are on Windows press CTRL + N and enter this AbsHListView and search. You will find the conflicting class.
EDIT:
Change your dependency like this:
compile project(':printio') {
exclude group: 'it.sephiroth.android.library.widget'
}