multidex error keep crashing - android

I just tried everything I found on stackoverflow and I can't solve my problem, I enabled multidexing and disabled miniyfenabled and nothing happened, here is my app build.gradle, I can't find the problem and is getting annoying since 3 hours now.
android {
signingConfigs {
}
compileSdkVersion 26
buildToolsVersion '26.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.xxxx.xxxx"
minSdkVersion 19
targetSdkVersion 26
versionCode 38
versionName "4.3.0" //
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Enabling multidex support.
multiDexEnabled true
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
buildTypes {
debug {
applicationIdSuffix '.debug'
}
//sourceSets.debug.resources.srcDirs = ['src/debug/res']
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
zipAlignEnabled true
}
}
// packagingOptions {
// exclude 'META-INF/LICENSE.txt'
// exclude 'META-INF/NOTICE.txt'
// }
}
repositories {
mavenCentral()
maven() { url "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'lib')
compile('com.github.worker8:tourguide:1.0.17-SNAPSHOT#aar') {
transitive = true
}
// Required -- JUnit 4 framework
compile files('libs/SimpleNLG-4.4.8.jar')
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/mail.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.6.5#aar') {
transitive = true;
}
compile('com.github.worker8:tourguide:1.0.17-SNAPSHOT#aar') {
transitive = true
}
// Optional -- Mockito framework
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.google.android.gms:play-services:11.8.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.google.android.gms:play-services-analytics:11.8.0'
implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation 'com.google.android.gms:play-services-auth:11.8.0'
implementation 'com.android.support:customtabs:26.1.0'
implementation 'junit:junit:4.12'
implementation 'com.android.support:multidex:1.0.2'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'io.github.kobakei:ratethisapp:1.2.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.mercadopago:sdk:3.7.2'
implementation 'com.google.guava:guava:23.3-android'
androidTestCompile 'com.android.support.test:runner:1.0.1'
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation group: 'com.google.apis', name: 'google-api-services-translate', version: 'v2-rev48-1.22.0'
implementation group: 'com.google.api-client', name: 'google-api-client-gson', version: '1.22.0'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
// Testing-only dependencies
androidTestCompile 'com.android.support.test:runner:1.0.1'
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.1'
compile('com.google.code.findbugs:jsr305:2.0.1')
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.0'
}
}
}
}
apply plugin: 'com.google.gms.google-services'
also tried disabling this implementation 'com.google.android.gms:play-services:11.8.0' and nothing too.

try with this inside dependencies
compile ('com.google.dagger:dagger:2.4') {
exclude group: 'com.google.guava'
}

Related

Firebase not generating FCM Token

After reformatting my laptop and installed the latest version of android studio
the FCM token generation suddenly stopped.
I updated firebase messaging to 18.0.0
App-level Build.gradle file
android {
compileSdkVersion 26
buildToolsVersion '28.0.3'
defaultConfig {
vectorDrawables.useSupportLibrary = true
applicationId "com.myapp.app"
minSdkVersion 21
targetSdkVersion 26
versionCode 21
versionName "1.0.21"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/notice'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license'
exclude 'META-INF/license.txt'
}
dexOptions {
javaMaxHeapSize "Xg"
// jumboMode = true
}
lintOptions {
abortOnError false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
//noinspection GradleCompatible
implementation 'com.android.support:design:26.1.0'
//noinspection OutdatedLibrary
implementation 'com.android.volley:volley:1.0.0'
implementation 'com.google.code.gson:gson:2.3'
implementation 'com.android.support:multidex:1.0.1'
implementation 'de.hdodenhof:circleimageview:1.2.1'
implementation 'com.github.gcacace:signature-pad:1.2.1'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:appcompat-v7:26.+'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.soundcloud.android:android-crop:1.0.1#aar'
implementation 'com.github.bumptech.glide:glide:3.5.2'
implementation 'com.google.android.gms:play-services-location:11.4.2'
implementation 'com.google.android.gms:play-services-maps:11.4.2'
implementation 'com.google.android.gms:play-services:11.4.2'
implementation 'com.google.android.gms:play-services-gcm:11.4.2'
implementation 'com.google.maps.android:android-maps-utils:0.5'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
//implementation 'com.google.firebase:firebase-core:11.4.2'
//implementation 'com.google.firebase:firebase-messaging:11.4.2'
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.firebase:firebase-messaging:18.0.0'
implementation 'com.intuit.sdp:sdp-android:1.0.5'
implementation 'com.shuhart.stepview:stepview:1.2.6'
implementation 'com.xw.repo:bubbleseekbar:3.6'
implementation 'com.github.andyxialm:ColorDialog:1.0.0'
implementation 'com.github.twinkle942910:monthyearpicker:0.0.1'
implementation 'com.daasuu:EasingInterpolator:1.0.0'
implementation 'com.agrawalsuneet.androidlibs:dotsloader:1.1'
implementation 'io.nlopez.smartlocation:library:3.3.3'
implementation 'com.bogdwellers:pinchtozoom:0.1'
implementation 'org.jsoup:jsoup:1.8.3'
implementation 'com.wdullaer:materialdatetimepicker:2.3.0'
implementation 'com.airbnb.android:lottie:2.5.0-rc1'
implementation 'com.razorpay:checkout:1.5.5'
implementation 'com.google.zxing:core:3.2.1'
}
apply plugin: 'com.google.gms.google-services'
Project Level Build.gradle file
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:4.1.0'
classpath 'io.fabric.tools:gradle:1.25.4'
}
}
all projects {
repositories {
jcenter()
maven {
url "https://maven.google.com" // Google's Maven repository
}
maven { url "https://jitpack.io" }
//mavenCentral()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Getting Error
error: cannot access zzbck
class file for com.google.android.gms.internal.zzbck not found
tried to change this with
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services:16.0.0'
implementation 'com.google.android.gms:play-services-gcm:16.0.0'

Duplicate jar entry - android

Am getting this warning during my build .
Warning: Exception while processing task java.io.IOException: Can't
write
[/Users/petrose/as_projects/MrPhone/app/build/intermediates/transforms/proguard/debug/0.jar]
(Can't read
[/Users/petrose/.gradle/caches/transforms-1/files-1.1/firebase-analytics-impl-16.2.4.aar/288ad7982e8f6024c8b5f0954f183721/jars/classes.jar(;;;;;;;**.class)]
(Duplicate jar entry
[com/google/android/gms/internal/measurement/eo.class]))
apply plugin: 'com.android.application'
//apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'org.greenrobot.greendao'
//apply plugin: 'io.fabric'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "....."
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables { useSupportLibrary = true }
multiDexEnabled true
resConfigs "en"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled true
useProguard true // obfuscate
shrinkResources true
}
debug {
minifyEnabled true
useProguard true // obfuscate
shrinkResources false
}
}
packagingOptions {
exclude 'META-INF/rxjava.properties'
}
}
greendao {
schemaVersion 1
}
dependencies {
//extLib
implementation files('libs/YouTubeAndroidPlayerApi.jar')
//support Lib
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "com.android.support:appcompat-v7:28.0.0"
implementation "com.android.support:recyclerview-v7:28.0.0"
implementation "com.android.support:cardview-v7:28.0.0"
implementation "com.android.support:design:28.0.0"
implementation "com.android.support:support-vector-drawable:28.0.0"
implementation "com.android.support.constraint:constraint-layout:$rootProject.constraintLibraryVersion"
implementation "com.android.support:customtabs:28.0.0"
//Google API Client Library
implementation('com.google.apis:google-api-services-youtube:v3-rev195-1.23.0') {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
exclude group: 'com.google.guava'
}
implementation('com.google.api-client:google-api-client-android:1.23.0') {
exclude group: 'org.apache.httpcomponents'
exclude group: 'com.google.guava'
}
// implementation('com.google.apis:google-api-services-calendar:v3-rev309-1.23.0') {
// exclude group: 'org.apache.httpcomponents'
// exclude group: 'com.google.guava'
//
// }
// image
//implementation "com.github.bumptech.glide:glide:$rootProject.glideVersion"
// implementation 'com.android.support:support-v4:27.1.1'
// implementation 'com.android.support.constraint:constraint-layout:1.1.0'
//annotationProcessor "com.github.bumptech.glide:compiler:$rootProject.glideVersion"
implementation "com.squareup.picasso:picasso:$rootProject.picassoVersion"
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.2'
implementation 'com.commit451:PhotoView:1.2.4'
//Network
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation "com.squareup.retrofit2:retrofit:$rootProject.retorfitVersion"
implementation 'com.squareup.retrofit2:converter-scalars:2.2.0'
implementation "com.squareup.retrofit2:converter-gson:$rootProject.retorfitVersion"
implementation "com.squareup.retrofit2:adapter-rxjava2:$rootProject.retorfitVersion"
implementation 'org.jsoup:jsoup:1.10.3'
// parser
implementation "com.google.code.gson:gson:$rootProject.gsonVersion"
implementation 'com.fatboyindustrial.gson-jodatime-serialisers:gson-jodatime-serialisers:1.6.0'
//parceler
implementation 'org.parceler:parceler-api:1.1.12'
annotationProcessor 'org.parceler:parceler:1.1.12'
// database
implementation "org.greenrobot:greendao:$rootProject.greenDaoVersion"
debugImplementation "com.amitshekhar.android:debug-db:$rootProject.debugDBVersion"
//eventBus
implementation "org.greenrobot:eventbus:$rootProject.greenrobotVersion"
//DI
implementation "com.google.dagger:dagger-android:$rootProject.dagger2Version"
annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"
implementation 'javax.inject:javax.inject:1'
compileOnly 'javax.annotation:jsr250-api:1.0'
// reactive
implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxjava2Version"
implementation "com.github.miguelbcr:RxPaparazzo:$rootProject.rxRxPaparazzo"
implementation 'com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.1.1'
implementation "com.github.akarnokd:rxjava2-extensions:0.18.7"
//butterknife
implementation "com.jakewharton:butterknife:$rootProject.butterKnifeVersion"
annotationProcessor "com.jakewharton:butterknife-compiler:$rootProject.butterKnifeVersion"
// logger
implementation "com.jakewharton.timber:timber:$rootProject.timberVersion"
implementation "com.github.nisrulz:easydeviceinfo-base:$rootProject.easyDeviceInfoVersion"
implementation 'com.github.tslamic:dn3:3.0'
//Firebase crash analytics
//implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
// facebook sdk
// implementation "com.facebook.android:facebook-android-sdk:$rootProject.facebookAndroidSDK"
// implementation "com.facebook.android:audience-network-sdk:$rootProject.facebookNetworkSDK"
implementation 'com.facebook.android:facebook-login:4.28.0'
implementation 'com.facebook.android:audience-network-sdk:5.1.0-beta'
// google sdk
// implementation "com.google.android.gms:play-services-analytics:$rootProject.googleLibraryVersion"
implementation('com.google.android.gms:play-services-analytics:16.0.4') {
exclude group: 'com.google.guava'
}
implementation('com.google.android.gms:play-services-ads:17.0.0') {
exclude group: 'com.google.guava'
}
implementation('com.google.android.gms:play-services-auth:16.0.0') {
exclude group: 'com.google.guava'
}
implementation('com.google.android.gms:play-services-gcm:16.0.0') {
exclude group: 'com.google.guava'
}
// fireBase libraries
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-config:16.1.3'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-inappmessaging-display:17.0.4'
implementation 'com.google.firebase:firebase-appindexing:17.1.0'
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
//implementation 'com.google.firebase:firebase-perf:16.2.3'
//implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
//leak
//debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
//releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
//testLib
//testImplementation 'junit:junit:4.12'
// androidTestImplementation 'com.android.support.test:runner:1.0.1'
// androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '27.1.1'
}
}
}
}
//Top-level build file
buildscript {
repositories {
google()
jcenter()
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
classpath 'io.fabric.tools:gradle:1.27.0'
classpath 'com.google.firebase:firebase-plugins:1.1.5'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
maven { url 'https://maven.google.com' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
While preparing for output jar (0.jar) at path {module}/build/intermediates/transforms/proguard/debug/0.jar, gradle copies all dependent library classes.jars and there dependent classes.jar to form a single intermediate jar. So when 2 different libraries are dependent on a single module, that single module is copied twice while leads to this error.
This can be solved by marking compileOnly to that single module in libraries which are using that module.

Error:Program type already present: android.support.compat.R

I cleaned the project and rebuild the project, but I am still getting the error that Error: Program type already present: android.support.compat.R
this is my build.gradle
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
lintOptions {
abortOnError false
checkReleaseBuilds false
}
defaultConfig {
applicationId "example.com"
minSdkVersion 21
versionCode 93
versionName "4.1.7"
// 92 416
multiDexEnabled true
}
buildTypes {
release {
// shrinkResources true
// minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
// these are the lines that you have to add
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/MANIFEST.MF'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
}
dataBinding {
enabled true
}
}
repositories {
maven {
url "https://repo.eclipse.org/content/repositories/paho-snapshots/"
}
maven { url 'https://maven.fabric.io/public' }
maven {
url
'https://github.com/suckgamony/RapidDecoder/raw/master/repository'
}
}
dependencies {
// implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso-
core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:customtabs:27.1.1'
implementation 'com.nostra13.universalimageloader:universal-image-
loader:1.9.5'
implementation 'com.amazonaws:aws-android-sdk-apigateway-core:2.3.1'
implementation 'com.amazonaws:aws-android-sdk-core:2.3.1'
implementation 'com.amazonaws:aws-android-sdk-s3:2.3.1'
// implementation 'com.google.code.gson:gson:2.7'
// compile files('libs/com.cielowigle-2.4.8.jar')
/* implementation 'com.google.android.gms:play-services-maps:10.2.6'
implementation 'com.google.android.gms:play-services-
location:10.2.6'
implementation 'com.google.android.gms:play-services-plus:10.2.6'
implementation 'com.google.android.gms:play-services-gcm:10.2.6'*/
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-plus:15.0.1'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
/* compile 'net.zetetic:android-database-sqlcipher:3.5.4#aar'*/
implementation('org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.1')
{
exclude group: 'com.android.support', module:'appcompat'
}
implementation('org.eclipse.paho:org.eclipse.paho.android.service:1.1.2-
SNAPSHOT') {
exclude group: 'com.android.support', module:'appcompat'
}
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.github.wangjiegulu:AndroidBucket:1.0.4'
implementation 'com.github.wangjiegulu:ShadowViewHelper:1.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
// implementation files('libs/bcpkix-jdk15on-1.52.jar')
// implementation files('libs/bcprov-jdk15on-1.54.jar')
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.1'
implementation 'com.wdullaer:materialdatetimepicker:2.5.0'
implementation 'com.facebook.android:facebook-android-sdk:4.27.0'
implementation 'com.nostra13.universalimageloader:universal-image-
loader:1.9.5'
apply plugin: 'com.google.gms.google-services'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation files('libs/Jsonvalidation.jar')
implementation('com.crashlytics.sdk.android:crashlytics:2.6.5#aar') {
transitive = true;
}
implementation 'com.timehop.stickyheadersrecyclerview:library:0.4.1'
implementation 'rapid.decoder:library:0.3.0'
//implementation 'rapid.decoder:jpeg-decoder:0.3.0'
//implementation 'rapid.decoder:png-decoder:0.3.0'
//Retrofit New Libs
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
// Dragger
/* implementation "com.google.dagger:dagger:2.11"
annotationProcessor "com.google.dagger:dagger-compiler:2.11"
// provided 'javax.hj:jsr250-api:1.0'
implementation 'javax.inject:javax.inject:1'*/
implementation 'com.google.dagger:dagger:2.11'
implementation 'com.google.dagger:dagger-android-support:2.11'
annotationProcessor 'com.google.dagger:dagger-compiler:2.11'
annotationProcessor 'com.google.dagger:dagger-android-processor:2.11'
// debug db
debugImplementation 'com.amitshekhar.android:debug-db:1.0.0'
implementation('com.crashlytics.sdk.android:answers:1.4.1#aar') {
transitive = true;
}
}
I tried also invalidate cache option but I am getting the same error. I updated gradle and Google play service latest version. This is working in debug option but not in release mode.

Duplicate entry: android/support/design/widget/CoordinatorLayout

I'm trying to create a signed APK, but an error will appear at the end:
Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/design/widget/CoordinatorLayout$1.class
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'
buildscript {
repositories {
maven { url "https://github.com/omadahealth/omada-nexus/raw/master/release" }
maven { url "https://jitpack.io" }
}
dependencies {
}
}
android {
signingConfigs {
config {
}
}
lintOptions {
abortOnError false
}
dataBinding {
enabled = true
}
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.myandroidapp.android"
minSdkVersion 17
targetSdkVersion 27
versionCode 5
versionName "1.3"
multiDexEnabled true
}
buildTypes {
release {
ext.enableCrashlytics = true
//shrinkResources false
//minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//debuggable false
//jniDebuggable false
signingConfig signingConfigs.config
//zipAlignEnabled true
}
debug {
//debuggable true
ext.enableCrashlytics = true
//minifyEnabled false
//shrinkResources false
//renderscriptDebuggable false
//jniDebuggable false
proguardFiles 'proguard-rules.txt'
//signingConfig signingConfigs.debug
}
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'META-INF/**'
exclude 'META-INF/**'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
mavenCentral()
jcenter()
}
android {
dexOptions {
jumboMode = true
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
// Navigation Drawer Library
compile('com.mikepenz:materialdrawer:5.3.0#aar') {
transitive = true
}
//Google, Inc (Play services) Libraries
implementation 'com.google.android.gms:play-services-places:11.8.0'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation 'com.google.android.gms:play-services-ads:11.8.0'
implementation 'com.google.android.gms:play-services-auth:11.8.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-crash:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-config:11.8.0'
implementation 'com.google.firebase:firebase-appindexing:11.8.0'
implementation 'com.google.android.gms:play-services-appinvite:11.8.0'
//Google, Inc (Firebase) Libraries
implementation 'com.firebase:firebase-jobdispatcher:0.6.0'
implementation 'com.firebaseui:firebase-ui-database:2.3.0'
implementation 'com.firebase:geofire-android:2.1.2'
// Google, Inc (Support) Libraries
implementation 'com.android.support:support-v13:27.0.2'
//implementation 'com.android.support:customtabs:27.0.2'
implementation 'com.android.support:cardview-v7:27.0.2'
implementation 'com.android.support:support-v4:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:multidex:1.0.2'
implementation 'com.android.support:palette-v7:27.0.2'
implementation 'com.android.support:support-vector-drawable:27.0.2'
//implementation 'com.android.support.constraint:constraint-layout:1.0.2'
// Facebook, Inc SDKs
implementation 'com.facebook.android:facebook-android-sdk:4.29.0'
// Libraries for images
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.github.bumptech.glide:glide:3.8.0'
implementation 'com.lorentzos.swipecards:library:1.0.9'
implementation 'com.skyfishjy.ripplebackground:library:1.0.1'
implementation 'com.vanniktech:emoji-twitter:0.5.1'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
implementation 'com.github.yalantis:ucrop:2.2.1'
implementation 'com.github.jkwiecien:EasyImage:1.3.1'
implementation 'jp.wasabeef:picasso-transformations:2.1.2'
implementation 'com.squareup.picasso:picasso:2.5.2'
// Location Helper Library
implementation 'com.squareup.retrofit2:retrofit:2.2.0'
implementation 'com.squareup.retrofit:converter-gson:2.0.0-beta1'
// Time library
implementation 'joda-time:joda-time:2.9.9'
implementation 'org.ocpsoft.prettytime:prettytime:4.0.1.Final'
// Others
// event bus
implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'com.flipboard:bottomsheet-core:1.5.3'
implementation 'com.flipboard:bottomsheet-commons:1.5.3'
implementation 'com.greysonparrelli.permiso:permiso:0.3.0'
implementation 'com.googlecode.libphonenumber:libphonenumber:8.5.2'
implementation 'com.airbnb.android:lottie:2.2.5'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
apply plugin: 'com.google.gms.google-services'
This may be due to different versions of the support library being used.
Add the following in your build.gradle
configurations.all {
resolutionStrategy {
force 'com.android.support:design:27.0.2'
force 'com.android.support:support-v4:27.0.2'
force 'com.android.support:appcompat-v7:27.0.2'
}
}

Error:Execution failed for task ':transformClassesWithMultidexlistForDebug'

After doing some refactors on my build.gradle, i can't stop having this error.
My application Class extends Multidex and is installed on attachBaseContext.
Clean + Rebuild don't work :(
I googled a lot, and i can't find anything. Can anyone help me?
Error:
java.io.IOException: Can't write [/build/intermediates/multi-dex/debug/componentClasses.jar] (Can't read [/build/intermediates/transforms/desugar/debug/106.jar(;;;;;;**.class)] (Duplicate zip entry [106.jar:android/support/design/widget/CoordinatorLayout$Behavior.class]))
build.gradle
tasks.whenTaskAdded { task ->
if (task.name == "lintVitalRelease") {
task.enabled = false
}
}
apply plugin: 'project-report'
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
repositories {
maven { url "https://jitpack.io" }
maven { url 'https://repo.spring.io/libs-milestone' }
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
google()
}
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
dependencies { classpath 'io.fabric.tools:gradle:1.24.3' }
}
android {
compileSdkVersion 27
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "appIdHere"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
minSdkVersion 17
targetSdkVersion 27
versionName "3.2.0.0"
versionCode 13
multiDexEnabled true
}
dataBinding.enabled = true
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
signingConfigs {
release {
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "2g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/notice'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license'
exclude 'META-INF/license.txt'
exclude 'META-INF/rxjava.properties'
}
}
dependencies {
ext {
android = '27.0.2'
firebase = '10.2.0'
}
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "com.android.support:appcompat-v7:$android"
implementation "com.android.support:cardview-v7:$android"
implementation "com.android.support:recyclerview-v7:$android"
implementation "com.android.support:design:$android"
implementation "com.android.support:palette-v7:$android"
implementation "com.android.support:support-v4:$android"
implementation "com.google.android.gms:play-services:10.2.0"
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.google.guava:guava:23.0-android'
implementation('com.crashlytics.sdk.android:crashlytics:2.7.0#aar') {transitive = true}
implementation 'com.android.support:multidex:1.0.2'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'net.danlew:android.joda:2.9.4.2'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.orhanobut:logger:1.15'
implementation 'com.joanzapata.iconify:android-iconify-fontawesome:2.2.2'
implementation 'com.beardedhen:androidbootstrap:1.2.3'
implementation 'com.github.aakira:expandable-layout:1.6.0#aar'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'io.realm:android-adapters:2.0.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.github.bluejamesbond:textjustify-android:2.1.6'
implementation 'com.github.darsh2:MultipleImageSelect:v0.0.4'
implementation 'com.daimajia.swipelayout:library:1.2.0#aar'
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
implementation 'br.com.jansenfelipe:androidmask:1.0.1'
implementation 'cat.ereza:customactivityoncrash:1.5.0'
implementation 'com.github.piasy:rxandroidaudio:1.5.1'
implementation 'com.github.chrisbanes:PhotoView:2.1.2'
implementation 'com.github.sharish:CreditCardView:v1.0.4'
implementation 'me.shaohui.advancedluban:library:1.3.5'
implementation 'com.github.jkwiecien:EasyImage:2.0.4'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'me.relex:circleindicator:1.2.2#aar'
implementation 'com.github.amlcurran.showcaseview:library:5.4.3'
implementation 'com.github.deano2390:MaterialShowcaseView:1.2.0#aar'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'io.reactivex:rxjava:1.1.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
androidTestCompile 'junit:junit:4.12'
}
apply plugin: "com.google.gms.google-services"
apply plugin: 'io.fabric'

Categories

Resources