How to resolve duplicate entry error while run project - android

Here is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.example.demo"
minSdkVersion 16
targetSdkVersion 21
multiDexEnabled true
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
aaptOptions
{
cruncherEnabled = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
repositories {
maven { url "https://jitpack.io" }
}
}
dependencies {
compile project(':draggerLibrary')
compile project(':staggeredGridViewmaster')
compile files('libs/httpclientandroidlib-1.2.1.jar')
compile files('libs/httpcore-4.4-beta1.jar')
compile files('libs/httpmime-4.3.jar')
compile project(':viewPagerLibrary')
compile project(path: ':ViewPagerLibrary')
compile 'com.android.support:multidex:1.0.1'
compile 'joda-time:joda-time:2.4'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.google.android.gms:play-services:11.0.2'
compile 'cn.pedant.sweetalert:library:1.3'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'com.google.guava:guava:20.0'
compile "com.daimajia.swipelayout:library:1.2.0#aar"
compile 'com.github.PhilJay:MPAndroidChart:v2.1.6'
compile 'org.apache.commons:commons-collections4:4.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.volley:volley:1.0.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
}
Error:Execution failed for task
':DemoProject:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
android/support/v4/provider/DocumentsContractApi19.class

Configure your build.gradle .
Use
compileSdkVersion 25
buildToolsVersion "25.0.2"
Then
compile 'com.google.android.gms:play-services:11.0.2'
compile 'com.android.support:appcompat-v7:25.3.1'
For your MAP problem use getMapAsync()
SupportMapFragment mapOBJ = ((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map));
mapOBJ.getMapAsync(this);
Read Replace getMap with getMapAsync

Related

Getting Duplicate entry java.util.zip.ZipException: duplicate entry:

I am getting the duplicate entry issue at runtime if I add the intercom library to my gradle.
This is my total app gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.0'
useLibrary 'org.apache.http.legacy'
defaultConfig {
lintOptions {
abortOnError false
disable "ResourceType"
checkReleaseBuilds false
}
ndk {
abiFilters "armeabi", "armeabi-v7a","x86"
}
applicationId "com.sample.activities"
minSdkVersion 19
targetSdkVersion 26
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
with_ImageProcessor {
}
without_ImageProcessor {
}
}
}
configurations {
}
dependencies {
compile 'com.google.android.gms:play-services-base:11.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.viewpagerindicator:library:2.4.1#aar'
configurations {
all*.exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services-gcm:11.0.1'
compile 'com.google.android.gms:play-services-location:11.0.1'
compile 'com.google.firebase:firebase-appindexing:11.0.1'
compile 'com.android.support:design:26.0.1'
compile 'com.android.support:design:26.0.2'
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support:support-v4:26.0.2'
compile 'com.android.support:support-v13:26.0.2'
//for intercom
compile 'io.intercom.android:intercom-sdk-fcm:4.+'
compile 'com.google.firebase:firebase-auth:11.0.1'
compile 'com.google.android.gms:play-services-auth:11.0.1'
compile 'com.google.firebase:firebase-database:11.0.1'
compile 'com.google.firebase:firebase-messaging:11.0.1'
compile 'com.uncopt:android.justified:1.0'
compile 'com.google.firebase:firebase-invites:11.0.1'
}
apply plugin: 'com.google.gms.google-services'
i am getting this issue afetr adding this line
compile 'io.intercom.android:intercom-sdk-fcm:4.+'
This is the run Time error I am getting
Error:Execution failed for task':waleteros:transformClassesWithJarMergingForWith_ImageProcessorDebug'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzbax.class
Please help me to resolve this issue
Try to add following version of intercom library instead of version you are using :
compile 'io.intercom.android:intercom-sdk-fcm:4.0.0'
OR
compile 'io.intercom.android:intercom-sdk-fcm:4.0.4'

TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/util/MapCollections$ArrayIterator.class

this is my project build.gradle file .whenever i run the project in android studio i get the duplicate entry: android/support/v4/util/MapCollections$ArrayIterator.class error
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "com.aitsolution.bizitapp.bizit"
minSdkVersion 16
targetSdkVersion 23
versionCode 14
versionName "1.13"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
dexOptions {
javaMaxHeapSize "3g"
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}
dependencies {
// compile fileTree(include: ['*.jar'], dir: 'libs')
// testCompile 'junit:junit:4.12'
compile files('libs/linkedin-j-android.jar')
compile files('libs/MobileOcrEngine.jar')
compile files('libs/signpost-core-1.2.1.1.jar')
compile files('libs/twitter4j-core-3.0.5.jar')
compile files('libs/ksoap2_2.6.0.jar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.google.android.gms:play-services-appindexing:9.0.0'
compile 'com.android.support:cardview-v7:23.3.+'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.google.code.gson:gson:2.4'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.edmodo:cropper:1.0.1'
}
I think facebook sdk comes with v4-support library exclude that and try.
compile ('com.facebook.android:facebook-android-sdk:4.6.0') {
exclude module: 'support-v4'
}

Error while running on pre-Lollipop versions

I'm getting this error
Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v7/util/SortedList$BatchedCallback.class
here is my build gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.cuztomise.services"
minSdkVersion 11
targetSdkVersion 21
multiDexEnabled =true
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:recyclerview-v7:23.2.1'
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.android.support:palette-v7:23.1.1'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.google.http-client:google-http-client-android:+'
compile 'com.google.api-client:google-api-client-android:+'
compile 'com.google.api-client:google-api-client-gson:+'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.android.support:multidex:1.0.1'
}
apply plugin: 'com.google.gms.google-services'
Use build took SDK V- 21 and java version 1_7 or below.
https://developer.android.com/about/dashboards/index.html
Are android apps backwards compatible?
Read this one very important:
Is it possible to use Java 8 for Android development?

Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

I have this error when I try to run my application.
Build is ok. Run makes errors.I tried to set multiDexEnable to true also butI still get the error..
This is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "it.prova.mine"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_7
}
}
repositories {
//mavenLocal()
mavenCentral()
}
dependencies {
//compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
//bug cardview
//vedi -> http://stackoverflow.com/questions/24455867/error-when- adding-cardview-to-layout
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:support-v4:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.1'
//Custom ProgressDialog
compile 'com.github.d-max:spots-dialog:0.4#aar'
//Url Encoder
compile 'org.droidparts:droidparts:2.9.1'
//SearchView
compile 'com.miguelcatalan:materialsearchview:1.3.1'
//Retrofit
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta3'
//jackson-jsog extension
compile 'com.voodoodyne.jackson.jsog:jackson-jsog:1.1'
//
compile 'com.fasterxml.jackson.core:jackson-databind:2.7.2'
compile 'com.google.code.gson:gson:2.6.2'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
//java.time backport
compile 'org.threeten:threetenbp:1.3.1'
//java.ws.rs.core
compile 'javax.ws.rs:jsr311-api:0.11'
//javax.xml.bind
compile 'javax.xml.bind:jaxb-api:2.1'
//javax.persistence
compile 'javax.persistence:persistence-api:1.0.2'
compile 'commons-codec:commons-codec:1.2'
//javax.json
compile 'org.glassfish:javax.json:1.0.4'
//jackson jsr310 plugin backport java7
compile 'com.github.joschi.jackson:jackson-datatype-threetenbp:2.4.4'
}
And this is the error:
Error
How can I do?
Thanks in advance

Update gradle to experimental version - Error

I'm following the guide http://tools.android.com/tech-docs/new-build-system/gradle-experimental to update my gradle configuration in order to use ndk.
Pluggin version: 0.6.0-alpha5
Gradle version: 2.10
After the changes, I get the error:
Gradle sync failed: Cause: com.android.build.gradle.managed.AndroidConfig$Impl
Here is my build.gradle. Did I forgot something or made a mistake ?
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.appid"
minSdkVersion.apiLevel 19
targetSdkVersion.apiLevel 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles.add(file('proguard-android.txt'))
proguardFiles.add(file('proguard-rules.pro'))
}
}
ndk {
moduleName "ImageProc"
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
// JSON serialization
compile 'com.google.code.gson:gson:2.4'
// Network
compile 'com.squareup.retrofit:retrofit:2.0.0-beta3'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'com.squareup.okhttp3:okhttp:3.0.0-RC1'
// Junit
testCompile 'org.robolectric:robolectric:3.0'
}
I believe that buildTypes should be outside the "android" block. Also, possibly replace "defaultConfig" with "defaultConfig.with" I followed build.gradle structure in this answer. Then Gradle finally was able to build.
Maybe this will help.
My working file for:
Android Studio: 3.0.1
with:
classpath 'com.android.tools.build:gradle-experimental:0.11.1'
looks like this:
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.niedved.xxx"
minSdkVersion.apiLevel 19
targetSdkVersion.apiLevel 22
ndk {
moduleName "mupdf"
}
multiDexEnabled true
jackOptions {
enabled true
}
}
buildTypes {
release {
jackOptions {
enabled true
}
minifyEnabled false
proguardFiles.add(file("proguard-rules.pro"))
}
}
productFlavors {
}
compileOptions.with {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
}
dependencies {
compile project(':main')
compile 'com.android.support:multidex:1.0.2'
compile 'com.google.http-client:google-http-client-android:+'
compile 'com.google.api-client:google-api-client-android:+'
compile 'com.google.api-client:google-api-client-gson:+'
compile 'com.google.code.gson:gson:2.6'
compile files('libs/devsmartlib.jar')
compile files('libs/ormlite-core-4.48.jar')
compile files('libs/ormlite-android-4.48.jar')
compile files('libs/retrofit-1.7.1.jar')
compile 'it.sephiroth.android.library.horizontallistview:hlistview:1.2.2'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.google.android.gms:play-services-maps:11.6.2'
compile 'com.google.android.gms:play-services:11.6.2'
}

Categories

Resources