Error inflating class mapbox MapView - with minifyEnabled - android

I've implemented mapbox correctly before using android sdk 28 to compile, now mapbox crash only in release mode because I've minifyEnabled true. If I set it to false, doesn't crash.
The Exception is
Binary XML Error inflating com.mapbox.mapboxsdk.maps.MapView.
I use mapbox on fragment, and call
Mapbox.getInstance(getContext(), "TOKEN")
before inflating view in onCreateView method. Even after, same problem.
I think is a gradle problem, that is
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.31.0'
}
}
apply plugin: 'com.android.application'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'io.fabric'
android {
signingConfigs {
debug {
keyAlias 'ewhfpiqwufgqeifbqeifb'
keyPassword 'dbhedeiqlgdqoiefqwouf'
}
release {
}
}
compileSdkVersion 28
defaultConfig {
applicationId "widjpewoqhfqiwfhuw"
minSdkVersion 19
targetSdkVersion 27
versionCode 65
versionName "1.1.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
debuggable false
minifyEnabled true
ext.enableCrashlytics = true
useProguard false
}
debug {
debuggable true
applicationIdSuffix ".debug"
minifyEnabled false
useProguard false
ext.enableCrashlytics = true
}
}
flavorDimensions "release", "debug"
productFlavors {
debugFlavor {
dimension "debug"
}
releaseFlavor {
dimension "release"
applicationIdSuffix ""
versionNameSuffix ""
}
}
dataBinding {
enabled = true
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation ('androidx.test.espresso:espresso-core:3.1.0') {
exclude group: 'com.android.support', module: 'support-annotations'
}
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-places:17.0.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.zxing:core:3.3.0'
implementation 'com.google.android.gms:play-services-vision:18.0.0'
implementation 'com.baoyz.swipemenulistview:library:1.3.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.github.bumptech.glide:glide:4.5.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'com.google.firebase:firebase-core:17.0.1'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.google.firebase:firebase-messaging:19.0.1'
implementation ('com.mapbox.mapboxsdk:mapbox-android-sdk:7.3.0'){
transitive=true
}
implementation 'com.hbb20:ccp:2.2.2'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.android.volley:volley:1.1.0'
implementation ('com.crashlytics.sdk.android:crashlytics:2.10.1#aar') {
transitive = true
}
}
apply plugin: 'com.google.gms.google-services'
Other info on crash:
Exception in onDidFinishLoadingStyle
java.lang.NullPointerException: throw with null exception
Abort message: 'terminating with uncaught exception of type
jni::PendingJavaException'
/data/app/mypkg-
qtZprFdEiYN4aOjj_lCtiA==/lib/arm64/libmapbox-gl.so

When you set minifyEnabled true, it will Enables code shrinking, obfuscation, and optimization which remove unused classes.
Use proguard to solve this:
https://github.com/mapbox/mapbox-android-demo/blob/master/MapboxAndroidDemo/proguard-rules.pro

Related

generate singed apk failed

when i update as to 3.6, there is an exception when i ./gradlew assembleRelease. and the infomation is like this
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:minifyReleaseWithR8'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:166)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:163)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:191)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:156)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
...
Caused by: java.lang.NullPointerException
at com.android.tools.r8.naming.A.a(:7)
at com.android.tools.r8.naming.A.c(:1)
at com.android.tools.r8.naming.w.a(:71)
at com.android.tools.r8.naming.w.a(:54)
at com.android.tools.r8.naming.w.a(:61)
at com.android.tools.r8.naming.w.a(:61)
at com.android.tools.r8.naming.w.a(:29)
at com.android.tools.r8.naming.G.a(:25)
...
my project gradle is
buildscript {
ext.kotlin_version = '1.3.61'
apply from:'config.gradle'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.meituan.android.walle:plugin:1.1.6'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local/' }
maven { url "https://jitpack.io" }
}
}
my app gradle is
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'walle'
def dep = rootProject.ext.dependencies
def and = rootProject.ext.android
android {
compileSdkVersion and.compileSdkVersion
buildToolsVersion and.buildToolsVersion
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
defaultConfig {
applicationId and.appid
minSdkVersion and.minSdkVersion
targetSdkVersion and.targetSdkVersion
versionCode 215005
versionName '3.0'
multiDexEnabled true
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
ndk {
abiFilters 'armeabi'
}
manifestPlaceholders = [
JPUSH_PKGNAME : ,
JPUSH_APPKEY : ' ',
JPUSH_CHANNEL : ' ',
]
}
signingConfigs {
release {
keyAlias ' '
keyPassword ' '
storeFile file('./release-key.keystore')
storePassword ' '
v1SigningEnabled true
v2SigningEnabled true
}
debug {
keyAlias ' '
keyPassword ' '
storeFile file('. ')
storePassword ' '
}
}
buildTypes {
debug {
debuggable true
minifyEnabled false
signingConfig signingConfigs.debug
buildConfigField('boolean', 'ISRELEASE', '${IS_RELEASE}')
}
release {
debuggable false
minifyEnabled true
shrinkResources true
zipAlignEnabled true
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
buildConfigField('boolean', 'ISRELEASE', '${IS_RELEASE}')
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
encoding = 'UTF-8'
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation dep.eventbus
implementation dep.immersionbar
implementation dep.immersionbarfragment
implementation dep.SmartRefreshLayout
// implementation dep.networking
implementation project(':android-networking')
// implementation 'com.amitshekhar.android:jackson-android-networking:1.0.2'
//glide
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
implementation dep.glide
implementation 'com.github.bumptech.glide:okhttp3-integration:4.9.0'
implementation 'androidx.annotation:annotation:1.1.0'
annotationProcessor 'androidx.annotation:annotation:1.1.0'
implementation dep.rxjava2
implementation dep.okhttp3
implementation dep.rxandroid
implementation dep.rxbinding2
implementation project(':qmui')
implementation project(':arch')
implementation project(':emoji')
implementation project(':reclib-qq')
implementation 'com.facebook.stetho:stetho:1.1.1'
//flowLayout
implementation(project(':flowlayout-lib')) {
transitive = true
exclude group: 'androidx.appcompat', module: 'appcompat'
}
implementation dep.multidex
implementation dep.banner
implementation dep.toast
implementation dep.brvah
implementation dep.gson
implementation dep.baseadapter
//webview
api dep.agentweb
api 'com.just.agentweb:filechooser:4.1.2'//
api 'com.download.library:Downloader:4.1.2'//
implementation dep.picker_view
implementation dep.picker_picture
// api dep.aliyun
implementation 'com.amap.api:3dmap:7.0.0'
implementation 'com.amap.api:location:4.7.2'
implementation 'com.amap.api:search:6.9.2'
/**kotlin*/
implementation "androidx.core:core-ktx:1.1.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//utils
implementation 'com.blankj:utilcode:1.25.9'
//tablayout//https://github.com/H07000223/FlycoTabLayout
implementation 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2#aar'
//butter knife
implementation "com.jakewharton:butterknife:$butterknifeVersion"
annotationProcessor "com.jakewharton:butterknife-compiler:$butterknifeVersion"
// api 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:5.5.7'
api 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:5.3.1'
implementation 'com.yanzhenjie.recyclerview:x:1.3.2'
implementation 'com.kingja.loadsir:loadsir:1.3.6'
/*lottie*/
implementation('com.airbnb.android:lottie:3.2.0') { exclude group: 'com.androidx' }
implementation 'cn.jiguang.sdk:jmessage:2.9.0' //
implementation 'cn.jiguang.sdk:jcore:2.2.2' //
implementation project(':reclib-testemoticons')
implementation 'cn.jiguang.sdk:jpush:3.4.0' //
implementation 'com.github.chrisbanes.photoview:library:1.2.4'
implementation 'com.github.mtotschnig:StickyListHeaders:2.7.1'
implementation 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
implementation 'com.yanzhenjie:permission:2.0.3'
debugImplementation 'com.didichuxing.doraemonkit:doraemonkit:3.0_beta2'
releaseImplementation 'com.didichuxing.doraemonkit:doraemonkit-no-op:3.0_beta2'
// api project(path: ':LibEasyGlide')
implementation 'com.binioter:guideview:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
//bugly
implementation 'com.tencent.bugly:crashreport:3.1.7'
implementation 'com.tencent.bugly:nativecrashreport:3.7.1'
implementation 'com.meituan.android.walle:library:1.1.6'
implementation "com.google.android.material:material:$materialVersion"
api project(path: ':LibEasyGlide')
}
the bottom is some dependencies, it all Commonly used library . when my android studio is 3.5.4,it work well, but when i update to 3.6 it build failed. i have no idea with this problem
and the gradle.properties is
org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
If you are use new NDK then try to add below code in gradle.properties (Project properties)
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
android.enableD8=true
android.bundle.enableUncompressedNativeLibs=false

Androidx :ERROR: Failed to resolve: legacy-support-core-utils

i got this error when trying to migrate my android app to androidX
with this implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:7.3.0'
but it's ok with :
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-localization-v7:0.8.0'
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-services:4.6.0'
this build.gradle class
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "net.healthintouch.hit"
minSdkVersion 21
targetSdkVersion 28
versionCode 7
versionName "1.013"
multiDexEnabled true
testInstrumentationRunner "android.support.register.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
def baseUrl
release {
baseUrl = '\"http://healthintouch.me/"'
buildConfigField 'String', 'BASE_URL', baseUrl
resValue "string", "BASE_URL", "healthintouch.me"
buildConfigField 'Boolean', 'enableCrashlytics', 'true'
debuggable false
minifyEnabled true
shrinkResources true
// useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
debug {
baseUrl = '\"http://192.168.1.3/"'
buildConfigField 'String', 'BASE_URL', baseUrl
resValue "string", "BASE_URL", "healthintouch.me"
debuggable true
ext.enableCrashlytics = false
minifyEnabled false
shrinkResources false
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildToolsVersion '28.0.3'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0-alpha05'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta1'
implementation 'androidx.core:core:1.2.0-alpha01'
implementation 'com.google.android.material:material:1.1.0-alpha07'
// implementation 'androidx.cardview:cardview:1.0.0-rc02'
// implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha05'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.databinding:databinding-adapters:3.6.0-alpha02'
implementation 'androidx.lifecycle:lifecycle-runtime:2.2.0-alpha01'
implementation 'com.jakewharton:butterknife:10.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
implementation 'com.wang.avi:library:2.1.3'
implementation 'com.github.bumptech.glide:glide:4.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.firebase:firebase-messaging:18.0.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'br.com.mauker.materialsearchview:materialsearchview:1.2.3'
implementation 'net.cachapa.expandablelayout:expandablelayout:2.9.2'
implementation 'com.google.android:flexbox:1.0.0'
implementation 'id.zelory:compressor:2.1.0'
implementation 'com.github.arabiaweather:arabic-time-sense:1.0.1'
implementation 'com.github.mthli:Knife:v1.1'
implementation 'com.github.drawers:SpinnerDatePicker:1.0.6'
implementation 'com.github.PierfrancescoSoffritti:AndroidYouTubePlayer:7.0.1'
implementation 'com.google.android.exoplayer:exoplayer-core:2.9.1'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.8.2'
implementation 'org.jsoup:jsoup:1.8.3'
implementation 'com.leocardz:link-preview:2.0.0#aar'
// implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:7.5.0-beta.1'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-localization-v7:0.8.0'
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-services:4.6.0'
implementation 'com.danikula:videocache:2.7.1'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
implementation "com.daimajia.swipelayout:library:1.2.0#aar"
implementation 'com.codesgood:justifiedtextview:1.1.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation group: 'com.github.michaelgantman', name: 'MgntUtils', version: '1.5.0.3'
testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
and this is buid.gradle
buildscript {
repositories {
maven { url 'https://maven.google.com' }
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url 'https://maven.google.com' }
maven { url "https://jitpack.io" }
maven { url 'https://github.com/leonardocardoso/mvn-repo/raw/master/maven-deploy'}
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
any answer ?
I had this problem, so I upgrade the Gradle plugin version then solved.

error Duplicate jar entry [android/support/v4/media/MediaBrowserCompat$a.class]

I have tried almost every solution there is on StackOverflow I recently updated my SDK from 27 to 28 and now on deploying my app, it gives me this error if I rollback the update it gives me resource linking error in merged.dir values XML before this my app was working correctly
My App Gradle build is
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.tech.usman.securityapp"
minSdkVersion 15
targetSdkVersion 28
versionCode 3
versionName "2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
/*release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}*/
release {
debuggable false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
pickFirst 'META-INF/LICENSE.txt' // picks the JavaMail license file
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
implementation 'com.google.android.material:material:1.0.0-beta01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0-beta01'
implementation 'androidx.vectordrawable:vectordrawable:1.0.0-beta01'
implementation 'com.google.firebase:firebase-messaging:17.4.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.android.support:appcompat-v7:27.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.android.support:design:27.0.1'
implementation 'com.github.ceryle:RadioRealButton:v2.1.1'
implementation 'com.android.support:support-v4:27.0.1'
implementation 'com.android.support:support-vector-drawable:27.0.1'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
// retrofit, gson
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
//implementation 'com.github.faruktoptas:FancyShowCaseView:1.0.0'
//circular progress
implementation 'com.github.rahatarmanahmed:circularprogressview:2.5.0'
//tray
implementation 'net.grandcentrix.tray:tray:0.12.0'
implementation('io.socket:socket.io-client:1.0.0') {
exclude group: 'org.json', module: 'json'
}
//http
//http looging
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
//dextor
implementation 'com.karumi:dexter:5.0.0'
//event bus
implementation 'org.greenrobot:eventbus:3.1.1'
//rx java
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.0'
implementation 'ru.rambler.android:swipe-layout:1.0.15'
implementation 'com.android.support:recyclerview-v7:27.0.1'
}
And my project gradle build previously my gradle tool version was com.android.tools.build:gradle:3.1.4
buildscript {
repositories {
google()
jcenter()
/*maven {
url 'https://maven.fabric.io/public'
}*/
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.0.1'
//classpath 'io.fabric.tools:gradle:1.25.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
maven {
url "https://maven.java.net/content/groups/public/"
}
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Caused by: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:

I am not able to build release APK. Every time I get DexMergerException.
Here are my build.gradles:
I am using MVVM structure. I have core(package name for core is same as my app package) has my lib where I only write view models, models and network layers.
Errors I am getting:
Caused by: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
Caused by: com.android.tools.r8.utils.AbortException
Program type already present:
app 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 {
debug {
storeFile file(DEBUG_STORE_FILE)
}
release {
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
v2SigningEnabled false
}
}
compileSdkVersion 27
flavorDimensions "default"
defaultConfig {
applicationId "com.puma.one8crew"
minSdkVersion 21
targetSdkVersion 27
vectorDrawables.useSupportLibrary = true
versionCode 1
multiDexEnabled true
versionName "1.0"
resValue 'string', 'facebook_app_id', FACEBOOK_APP_ID_DEV
resValue 'string', 'fb_login_protocol_scheme', FACEBOOK_LOGIN_PROTOCOL_SCHEME
manifestPlaceholders += [
FACEBOOK_APP_ID_BGY: FACEBOOK_APP_ID_DEV,
FB_LOGIN_SCHEME : FACEBOOK_LOGIN_PROTOCOL_SCHEME
]
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dataBinding {
enabled = true
}
buildTypes {
debug {
minifyEnabled false
signingConfig signingConfigs.debug
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
/* productFlavors {
prod {
resValue 'string', 'facebook_app_id', FACEBOOK_APP_ID_DEV
resValue 'string', 'fb_login_protocol_scheme', FACEBOOK_LOGIN_PROTOCOL_SCHEME
}
stage {
resValue 'string', 'facebook_app_id', FACEBOOK_APP_ID_DEV
resValue 'string', 'fb_login_protocol_scheme', FACEBOOK_LOGIN_PROTOCOL_SCHEME
}
}*/
applicationVariants.all { variant ->
variant.outputs.all { output ->
def project = "one8crew"
outputFileName = "${project}_${variant.buildType.name}_${variant.versionName}.apk"
}
}
dexOptions {
javaMaxHeapSize "4g" //specify the heap size for the dex process
preDexLibraries = true //delete the already predexed libraries
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':core')
implementation 'com.android.support:animated-vector-drawable:27.0.1'
implementation 'com.android.support:customtabs:27.0.1'
implementation 'com.android.support:cardview-v7:27.0.1'
implementation 'com.android.support:appcompat-v7:27.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.facebook.android:facebook-android-sdk:4.31.0'
implementation 'com.android.support:recyclerview-v7:27.0.1'
implementation 'com.google.firebase:firebase-messaging:12.0.1'
implementation 'com.google.android.gms:play-services-auth:12.0.1'
implementation 'com.android.support:support-v4:27.0.1'
implementation 'com.android.support:design:27.0.1'
implementation 'com.android.support:support-v13:27.0.1'
implementation 'com.alimuzaffar.lib:pinentryedittext:1.3.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
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'
//Dependencies for LifeCycle Android ViewModel
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation project(':com.wowza.gocoder.sdk')
implementation 'com.skyfishjy.ripplebackground:library:1.0.1'
//support design lib dependency fot tab
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation('com.crashlytics.sdk.android:crashlytics:2.9.1#aar') {
transitive = true;
}
}
Below is my core build.gradle and I have also updated the same version for all lib.
core build.gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 27
defaultConfig {
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
repositories {
flatDir {
dirs 'libs'
}
jcenter()
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
compileOnly 'com.wowza.gocoder.sdk.android:com.wowza.gocoder.sdk:1.0b7#aar'
// compile 'android.arch.lifecycle:extensions:1.1.1'
implementation 'com.google.dagger:dagger:2.11'
api('com.squareup.retrofit2:retrofit:2.1.0') {
exclude module: 'okhttp'
}
api 'com.google.code.gson:gson:2.8.1'
api 'com.squareup.retrofit2:converter-gson:2.3.0'
api 'swarajsaaj:otpreader:1.1'
api 'com.github.bumptech.glide:glide:4.3.0'
annotationProcessor 'com.google.dagger:dagger-compiler:2.11'
//Dependencies for LifeCycle Android ViewModel
implementation 'android.arch.lifecycle:extensions:1.1.1'
// annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
compileOnly project(':com.wowza.gocoder.sdk')
compile project(':libraries:horizontalcalendar')
compile project(':libraries:calendarview')
//Library for setting fonts
api 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation 'com.android.support:multidex:1.0.3'
}
I tried so many time and I am not able to understand the reason behind this issue.
Same happened today to me and this is what solved the issue:
Find all the dependencies of com.google.android.gms:play-services.
They all have now different versions. Just place the mouse over them and correct the version numbers (i.e. for me was upgrading maps from 15.0.0 to 15.0.2 and tag-manager to 15.0.1)

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'
}
}

Categories

Resources