Duplicate jar entry - android - 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.

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'

Program type already present: com.google.android.gms.internal.measurement.zzu when adding firebase-perf library

As soon as I add latest version of firebase-perf library it stops compiling with the following error:
Caused by: com.android.tools.r8.utils.AbortException:
Error: Program type already present: com.google.android.gms.internal.measurement.zzu
Note: I am already using latest version of all the available dependencies from android and Firebase.
My project level build.gradle:
buildscript {
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'com.google.firebase:firebase-plugins:1.1.5'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
maven { url 'http://dl.bintray.com/amulyakhare/maven' }
maven { url "https://jitpack.io" }
maven {
url 'https://github.com/WickeDev/stetho-realm/raw/master/maven-repo'
}
}
}
My app level build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'
task wrapper(type: Wrapper) {
gradleVersion = '4.1'
}
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:5.4.1"
}
}
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex')) {
details.useVersion "26.1.0"
}
}
}
}
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion 15
targetSdkVersion 28
versionCode 180
versionName "2.11.8"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
resConfigs "en"
}
dexOptions {
javaMaxHeapSize "4G"
maxProcessCount 4
}
buildTypes {
debug {
minifyEnabled false
}
release {
minifyEnabled true
shrinkResources true
proguardFile getDefaultProguardFile('proguard-android.txt')
fileTree(dir: 'proguard-rules', include: '*.pro').each { file -> proguardFile file }
}
}
aaptOptions {
cruncherEnabled false
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'META-INF/ECLIPSE_.SF'
exclude 'META-INF/ECLIPSE_.RSA'
}
}
dependencies {
// https://mvnrepository.com/artifact/commons-codec/commons-codec
implementation group: 'commons-codec', name: 'commons-codec', version: '1.10'
// Support library
implementation('com.android.support:appcompat-v7:28.0.0') {
exclude group: 'com.android.support', module: 'support-annotations'
}
// Play services
implementation('com.google.android.gms:play-services-analytics:15.0.2') {
exclude group: 'com.android.support'
// exclude group: 'com.google.android.gms', module: 'play-services-basement'
// exclude group: 'com.google.android.gms', module: 'play-services-measurement-base'
}
implementation 'com.google.android.gms:play-services-auth:16.0.1';
// Square
implementation("com.squareup.okhttp3:okhttp:3.12.0")
implementation('com.squareup.okhttp3:logging-interceptor:3.12.0') {
transitive = false
}
implementation('com.squareup.retrofit2:retrofit:2.5.0') {
// exclude Retrofit’s OkHttp peer-dependency module and define your own module import
exclude module: 'okhttp'
}
implementation 'com.squareup.retrofit2:adapter-rxjava:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
// UI/UX
implementation('com.kogitune:pre-lollipop-activity-transition:1.3.0') {
exclude group: 'com.android.support'
}
//App Intro
implementation('com.github.paolorotolo:appintro:4.1.0#aar') {
exclude group: 'com.android.support'
transitive = true
}
// Tools
implementation('io.branch.sdk.android:library:2.+') {
exclude group: 'com.android.support'
}
implementation('com.crashlytics.sdk.android:crashlytics:2.5.2#aar') {
transitive = true
}
// Test
androidTestImplementation('com.android.support.test.espresso:espresso-contrib:2.2') {
// Necessary to avoid version conflicts
exclude module: 'recyclerview-v7'
}
// Razorpay
implementation 'com.razorpay:checkout:1.5.1'
//Reactive Location
implementation 'pl.charmas.android:android-reactive-location:1.0#aar'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:exifinterface:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-media-compat: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-annotations:28.0.0'
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.libraries.places:places-compat:1.0.0'
implementation 'com.squareup.okio:okio:1.15.0'
implementation 'com.google.code.gson:gson:2.8.5'
dependencies {
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
implementation 'com.jakewharton.timber:timber:4.1.2'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
implementation 'com.balysv:material-ripple:1.0.2'
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'com.timehop.stickyheadersrecyclerview:library:0.4.3#aar'
implementation 'me.zhanghai.android.materialprogressbar:library:1.1.4#aar'
implementation 'com.wdullaer:materialdatetimepicker:2.3.0#aar'
implementation 'com.orhanobut:logger:1.8'
implementation 'com.facebook.conceal:conceal:1.0.1#aar'
implementation 'io.reactivex:rxjava:1.3.0'
implementation 'io.reactivex:rxandroid:1.2.1#aar'
implementation 'com.f2prateek.rx.preferences:rx-preferences:1.0.2#aar'
implementation 'com.tbruyelle.rxpermissions:rxpermissions:0.9.4#aar'
dependencies {
implementation 'com.google.dagger:dagger:2.13'
annotationProcessor 'com.google.dagger:dagger-compiler:2.13'
}
dependencies {
implementation 'com.github.matthiasrobbers:shortbread:1.0.2'
annotationProcessor 'com.github.matthiasrobbers:shortbread-compiler:1.0.2'
}
implementation 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation('com.google.firebase:firebase-perf:16.2.3') <------------- Compile issue happens when I add this
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0'
// implementation 'com.uphyca:stetho_realm:2.3.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'org.robolectric:robolectric:3.0'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'
androidTestImplementation 'com.jakewharton:butterknife:8.8.1'
androidTestImplementation 'com.android.support:support-annotations:28.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-intents:3.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-idling-resource:3.0.2'
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
androidTestImplementation 'com.android.support:support-v4:28.0.0'
implementation 'com.elyeproj.libraries:loaderviewlibrary:1.4.1'
// Animations
implementation 'com.android.support:support-compat:28.0.0'
implementation 'com.daimajia.easing:library:2.0#aar'
implementation 'com.daimajia.androidanimations:library:2.3#aar'
// Pusher
implementation 'com.pusher:pusher-java-client:1.6.0'
// Custom crash activity
implementation 'cat.ereza:customactivityoncrash:2.2.0'
// Snackbar
implementation 'com.github.matecode:Snacky:1.0.3'
// Progress bar
implementation 'com.github.castorflex.smoothprogressbar:library:1.3.0'
implementation 'com.github.chrisbanes:PhotoView:2.0.0'
// debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.2'
// releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.2'
implementation 'org.conscrypt:conscrypt-android:1.4.1'
// Facebook connection class to classify network bandwidth
implementation 'com.facebook.network.connectionclass:connectionclass:1.0.1';
}
apply from: 'tasks.gradle'
apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
I solved this problem by removing play-services-analytics from the app level build.gradle.
implementation('com.google.android.gms:play-services-analytics:15.0.2') {
exclude group: 'com.android.support'
}
It seems like firebase analytics and google analytics can't coexist.

Android Build Error - error: cannot access zzbgl class file for com.google.android.gms.internal.zzbgl not found

I am developing an Android app and when building the app for generating a signed file for publishing I am getting the following error.
error: cannot access zzbgl
class file for com.google.android.gms.internal.zzbgl not found
My **build.gradle (Module: app)** file is this:
`apply plugin: 'com.android.application'
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
}
android {
compileSdkVersion 27
defaultConfig {
applicationId 'com.brainoidtech.dbm'
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
manifestPlaceholders = [onesignal_app_id: "a515bddd-f7c8-48c9-a079-372706858f8d", onesignal_google_project_number: "REMOTE"]
}
repositories {
mavenCentral()
mavenLocal() // For google-play-services is not on Maven Central.
//for vimeo video player
maven { url "https://jitpack.io" }
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt')
proguardFile 'proguard-google-api-client.txt'
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
aaptOptions {
cruncherEnabled = false
}
productFlavors {
}
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/INDEX.LIST'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
}
dependencies {
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:preference-v7:27.1.1'
implementation 'com.android.support:preference-v14:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
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.squareup.okhttp3:okhttp:3.11.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.bogdwellers:pinchtozoom:0.1'
implementation 'com.daimajia.slider:library:1.1.5#aar'
implementation 'com.crystal:crystalrangeseekbar:1.1.1'
implementation 'com.github.apl-devs:appintro:v4.2.3'
implementation 'hyogeun.github.com.colorratingbar:ColorRatingBar:1.0.1'
implementation 'com.onesignal:OneSignal:3.10.1'
implementation 'com.facebook.android:facebook-android-sdk:4.39.0'
implementation 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.google.firebase:firebase-ads:12.0.1'
implementation 'com.google.firebase:firebase-auth:12.0.1'
implementation 'com.google.firebase:firebase-messaging:12.0.1'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
//Multidex dependency
implementation 'com.android.support:multidex:1.0.3'
//R- rules
implementation 'org.dmfs:rfc5545-datetime:0.2.4'
//Rounded image view
implementation 'com.makeramen:roundedimageview:2.2.1'
implementation 'com.google.apis:google-api-services-calendar:v3-rev260-1.23.0' exclude module: 'httpclient'
implementation 'com.google.api-client:google-api-client-android:1.23.0' exclude module: 'httpclient'
implementation 'com.google.http-client:google-http-client-gson:1.23.0' exclude module: 'httpclient'
implementation 'com.google.api-client:google-api-client:1.25.0'
implementation 'com.google.oauth-client:google-oauth-client-jetty:1.23.0'
//Exo Player
implementation 'com.google.android.exoplayer:exoplayer:2.9.2'
//Youtube video api
implementation project(':YouTubeAndroidPlayerApi')
//Vimeo video player
implementation 'com.github.ed-george:AndroidVimeoExtractor:1.1.2'
//Pdf reader
implementation 'com.github.barteksc:android-pdf-viewer:3.1.0-beta.1'
implementation 'com.mindorks.android:prdownloader:0.5.0'
}
apply plugin: 'com.google.gms.google-services'
My build.gradle (Project: myPorojectName) file is this:
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url "https://jitpack.io"}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have tried solutions posted on the internet or on stackoverflow but the solutions do not seem to work for me or am I doing something wrong?
Any help at all will be appreciated. Thank you!

Program type already present com google protobuf DescriptorProtos

After a couple of hours I decided to share my problem.
// Root build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.1.0'
classpath "io.realm:realm-gradle-plugin:5.4.1"
}
}
allprojects {
repositories {
google()
jcenter()
maven {url 'http://jitpack.io'}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
// 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'
apply plugin: 'realm-android'
repositories {
google()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
maven { url 'https://dl.bintray.com/siclo/SicloAndroidOSS' }
}
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
dexOptions {
javaMaxHeapSize "4g"
jumboMode true
preDexLibraries = false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
multiDexEnabled true
applicationId "my.chart.card.app"
minSdkVersion 17
targetSdkVersion 28
versionCode 63
versionName "2.1.7"
vectorDrawables.useSupportLibrary = true
}
// SOME GRADLE CODE BUT I CUT IT (build release ...)
ext.ANDROID_SUPPORT_LIBRARY_VERSION = "28.0.0"
ext.GOOGLE_PLAY_VERSION = "16.0.0"
ext.FIREBASE_VERSION = "16.0.4"
dependencies {
configurations {
all*.exclude group: 'com.android.support', module: 'support-v13'
all*.exclude group: 'com.google.firebase', module: 'firebase-crash'
all*.exclude group: 'com.google.protobuf', module: 'protobuf-lite'
}
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:' + ANDROID_SUPPORT_LIBRARY_VERSION
implementation 'com.android.support:support-v4:' + ANDROID_SUPPORT_LIBRARY_VERSION
implementation 'com.android.support:exifinterface:' + ANDROID_SUPPORT_LIBRARY_VERSION
implementation 'com.android.support:percent:' + ANDROID_SUPPORT_LIBRARY_VERSION
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:' + ANDROID_SUPPORT_LIBRARY_VERSION
implementation 'com.android.support:cardview-v7:' + ANDROID_SUPPORT_LIBRARY_VERSION
implementation 'com.google.android.gms:play-services-location:' + GOOGLE_PLAY_VERSION
implementation 'com.google.android.gms:play-services-places:' + GOOGLE_PLAY_VERSION
implementation 'com.google.maps.android:android-maps-utils:0.5'
implementation 'com.google.firebase:firebase-core:' + FIREBASE_VERSION
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-database:16.0.3'
implementation 'com.google.firebase:firebase-auth:' + FIREBASE_VERSION
implementation 'com.google.firebase:firebase-storage:16.0.3'
implementation ('com.firebaseui:firebase-ui-firestore:4.2.0') {
exclude group: "com.google.protobuf", module: "protobuf-lite"
}
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation 'com.simmorsal.library:concealer_nested_scroll_view:2.0.0'
implementation 'jp.wasabeef:recyclerview-animators:2.2.7'
implementation 'com.gmail.samehadar:iosdialog:1.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.1.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
implementation 'io.card:android-sdk:5.5.1'
implementation 'com.google.guava:guava:23.6-android'
implementation 'com.cleveroad:slidingtutorial:1.0.8'
implementation 'com.github.takusemba:spotlight:1.1.3'
implementation 'uk.co.chrisjenx:calligraphy:2.2.0'
implementation 'com.aurelhubert:ahbottomnavigation:2.1.0'
implementation 'com.irozon.sneaker:sneaker:1.0.3'
implementation('com.lamudi.phonefield:phone-field:0.1.3#aar') {
transitive = true
}
implementation 'uk.co.deanwild:flowtextview:2.0.2#aar'
implementation 'de.greenrobot:eventbus:2.4.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.facebook.android:facebook-login:4.37.0'
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.algolia:algoliasearch-android:3.+'
implementation 'com.github.takusemba:multisnaprecyclerview:1.3.3'
implementation 'com.github.livefront:bridge:v1.1.2'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.commonsware.cwac:provider:0.5.0'
implementation 'io.intercom.android:intercom-sdk-base:5.+'
implementation('io.intercom.android:intercom-sdk-fcm:5.+') {
exclude group: 'io.intercom.android', module: 'intercom-sdk-base'
}
implementation 'com.siclo.ezphotopick:library:1.0.8'
}
apply plugin: 'com.google.gms.google-services'
Since I updated to 3.2.1 and google play services to 4.1.0 and added Firebase/Firestore libraries I got this error :
Error: Program type already present: com.google.protobuf.DescriptorProtos$DescriptorProto$Builder
I tried ./gradlew :app:dependencies > ./dependencies.txt and exclude protobuff like this exclude group: "com.google.protobuf", module: "protobuf-lite" but it seems to be wrong, still the error.
gradle-4.6-all.zip
Android studio 3.2
If someone encounters the same problem and have some solution,it would be nice.
The duplicate one was inside this lib
implementation('com.lamudi.phonefield:phone-field:0.1.3#aar')
But I don't know why ./gradlew :app:dependencies didn't show the evidence.
The problem comes from your com.lamudi.phonefield dependency. There is a googlecode dependency that causes the crash.
Try to fork and update to implementation 'com.googlecode.libphonenumber:libphonenumber:8.10.3'
The lib is not maintained anyway. Otherwise, there is this fork existing: https://github.com/ialokim/android-phone-field
Downgrading firestore to v12.0.0 removes this conflict

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.

Categories

Resources