Android build issue - android

I get error "Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 16.0.5."
Build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'org.jacoco:org.jacoco.core:0.8.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url = 'https://oss.sonatype.org/content/groups/public' }
maven {
url "https://maven.google.com"
}
}
}
configurations.all {
transitive = true
}
Build.gradle
dependencies {
implementation fileTree(include: '*.jar', dir: 'libs')
implementation 'com.android.support:support-v13:27.1.0'
implementation 'com.android.support:customtabs:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:exifinterface:27.1.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.5'
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'
implementation('com.google.code.gson:gson:2.6.2') {
exclude group: 'org.apache.httpcomponents'
}
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation('com.google.http-client:google-http-client:1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation('com.google.oauth-client:google-oauth-client:1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation 'commons-io:commons-io:2.5'
implementation 'net.sf.kxml:kxml2:2.3.0'
implementation 'net.sf.opencsv:opencsv:2.3'
implementation('org.opendatakit:opendatakit-javarosa:2.9.0') {
exclude module: 'joda-time'
}
implementation 'org.osmdroid:osmdroid-android:5.6.4'
implementation 'org.slf4j:slf4j-android:1.6.1-RC1'
implementation 'pub.devrel:easypermissions:0.2.1'
implementation('com.google.api-client:google-api-client-android:1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation('com.google.apis:google-api-services-drive:v3-rev64-1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation('com.google.apis:google-api-services-sheets:v4-rev463-1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation 'com.jakewharton.timber:timber:4.6.0'
implementation 'com.google.zxing:core:3.3.0'
implementation 'com.journeyapps:zxing-android-embedded:3.5.0'
implementation 'net.danlew:android.joda:2.9.9'
// Real LeakCanary for debug builds only: notifications, analysis, etc
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
// No-Op version of LeakCanary for release builds: no notifications, no analysis, nothing
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
androidTestImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
odkCollectReleaseImplementation group: 'com.squareup.leakcanary', name: 'leakcanary-android-no-op', version: '1.5.4'
// Android Architecture Components:
implementation 'android.arch.lifecycle:extensions:1.1.0'
// Dagger:
implementation 'com.google.dagger:dagger-android:2.11'
implementation 'com.google.dagger:dagger-android-support:2.11'
annotationProcessor 'com.google.dagger:dagger-android-processor:2.11'
annotationProcessor 'com.google.dagger:dagger-compiler:2.11'
// RxJava 2:
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.1.10'
// Better "Subjects" for Rx:
implementation 'com.jakewharton.rxrelay2:rxrelay:2.0.0'
// Android bindings for Rx:
implementation 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
// RxLifecycle (binds subscription cleanup to component lifecycle):
implementation 'com.trello.rxlifecycle2:rxlifecycle:2.2.1'
implementation 'com.trello.rxlifecycle2:rxlifecycle-android:2.2.1'
implementation 'com.trello.rxlifecycle2:rxlifecycle-android-lifecycle:2.2.1'
// Makes binding to Views easy:
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
// Used to generate documentation screenshots.
androidTestCompile 'tools.fastlane:screengrab:1.1.0'
// Testing-only dependencies
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.8.47'
testImplementation 'org.robolectric:robolectric:3.5.1'
testImplementation 'org.robolectric:shadows-multidex:3.5.1'
// power mock (for mocking final methods which is not handled by mockito)
testImplementation 'org.powermock:powermock-module-junit4:1.6.4'
testImplementation 'org.powermock:powermock-api-mockito2:1.7.3'
androidTestImplementation 'org.mockito:mockito-android:2.11.0'
androidTestImplementation('com.android.support.test:runner:1.0.1') {
exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1') {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.google.code.findbugs', module: 'jsr305'
}
androidTestImplementation('com.android.support.test.espresso:espresso-intents:3.0.1') {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.google.code.findbugs', module: 'jsr305'
}
androidTestImplementation 'com.squareup.okhttp3:mockwebserver:3.9.0'
}
I saw errors downloading FireBase libraries as well while gradle performs synchronization. I'm upgrading an old app in order to use geofencing API.
Many thanks.

Update the classpath 'com.google.gms:google-services:4.1.0' in project build.gradle.

Related

FirebaseApp with name [DEFAULT] doesn't exist after trying to implement Google Speech to Text

I have had an application with working Firestore. Then I tried adding Google Speech to Text to the application and suddenly Firestore connection stops working. Here I will post before and after app/build.gradle script in a hope that anyone could see the issue. I will not post the parts of the script that did not change.
Before:
dependencies {
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.browser:browser:1.2.0'
implementation 'com.squareup.okhttp3:okhttp:4.8.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'dev.dworks.libs:astickyheader:0.1.0'
implementation 'se.emilsjolander:stickylistheaders:2.7.0'
implementation 'com.github.wangjiegulu:AndroidBucket:1.0.4'
implementation 'com.android.support:preference-v7:29.0.0'
implementation "androidx.appcompat:appcompat:1.1.0"
implementation 'com.google.firebase:firebase-analytics:17.5.0'
implementation 'com.android.support:support-v4:29.0.0'
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.google.firebase:firebase-firestore:21.6.0'
}
After
dependencies {
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.browser:browser:1.2.0'
implementation 'com.squareup.okhttp3:okhttp:4.8.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'dev.dworks.libs:astickyheader:0.1.0'
implementation 'se.emilsjolander:stickylistheaders:2.7.0'
implementation 'com.github.wangjiegulu:AndroidBucket:1.0.4'
implementation 'com.android.support:preference-v7:29.0.0'
implementation "androidx.appcompat:appcompat:1.2.0"
//implementation 'com.google.firebase:firebase-analytics:17.5.0'
implementation 'com.android.support:support-v4:29.0.0'
implementation 'com.android.support:support-annotations:28.0.0'
implementation fileTree(include: '*.jar', dir: 'libs')
implementation ('com.google.firebase:firebase-firestore:21.6.0') {
exclude(group: 'com.google.firebase', module: 'firebase-database-collection')
exclude(group: 'com.google.firebase', module: 'firebase-auth-interop')
exclude(group: 'com.google.firebase', module: 'firebase-common')
}
implementation 'com.google.api.grpc:grpc-google-cloud-speech-v1:1.23.0'
implementation 'com.google.firebase:firebase-admin:6.2.0'
}
configurations.implementation.exclude(group: 'com.google.firebase', module: 'protolite-well-known-types')
configurations.implementation.exclude(group: 'com.google.guava', module: 'guava-jdk5')
configurations.implementation.exclude(group: 'com.google.protobuf', module: 'protobuf-javalite')
configurations.implementation.exclude(group: 'com.google.firebase', module: 'firebase-auth-interop')
configurations.implementation.exclude(group: 'com.google.firebase', module: 'firebase-common')*/
configurations.implementation.exclude(group: 'com.google.android.gms', module: 'play-services-basement')
The change produces the following error: java.lang.IllegalStateException: FirebaseApp with name [DEFAULT] doesn't exist.
What could be causing me these issues?

Warning on gradle after adding play-services-auth 16.0.1

After adding play-services-auth version 16.0.1 to implement google login on my android app I am getting a warning whereas libraries are incompatible. The warning is about mixing versions:
com.android.support:animated-vector-drawable:28.0.0 and com.android.support:support-media-compat:26.1.0
This is the relevant part in my build.gradle file:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.loopj.android:android-async-http:1.4.9'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.google.android.gms:play-services-auth:16.0.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'
implementation 'com.android.support:recyclerview-v7:28.0.0'
}
I am not using com.android.support:support-media-compat:26.1.0 so I cannot understand the reason.
You're using media-compat, but not directly, your dependencies use it, you can fix it by excluding:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0', {
exclude group: 'com.android.support', module: 'support-media-compat:26.1.0'
}
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.loopj.android:android-async-http:1.4.9'
implementation 'com.android.support:design:28.0.0', {
exclude group: 'com.android.support', module: 'support-media-compat:26.1.0'
}
implementation 'com.android.support:support-vector-drawable:28.0.0', {
exclude group: 'com.android.support', module: 'support-media-compat:26.1.0'
}
implementation 'com.google.android.gms:play-services-auth:16.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2', {
exclude group: 'com.android.support', module: 'support-media-compat:26.1.0'
}
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:recyclerview-v7:28.0.0', {
exclude group: 'com.android.support', module: 'support-media-compat:26.1.0'
}
}
Also, you can research all your dependencies by executing this command in terminal:
./gradlew app:dependencies
where app - is your module name

Gradle: Error: Program type already present: androidx.activity.R$attr

When adding
implementation
('com.google.android.ads.consent:consent-library:1.0.0') {
exclude module: 'androidx.activity'
}
to my app/build.gradle file i get this error:
Error: Program type already present: androidx.activity.R$attr
What i did do:
1. gradlew androidDependencies
But i cannot find any duplicates
Read: https://developer.android.com/studio/build/dependencies#duplicate_classes.
Other stackoverflow answers suggesting excluding support library versions dont help me
repositories {
maven { url 'https://maven.fabric.io/public' }
}
configurations {
all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}
configurations.all {exclude group: 'com.android.support', module: 'support-v13'}
dependencies {
def nav_version = "1.0.0"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0-alpha05'
implementation 'androidx.core:core-ktx:1.1.0-alpha05'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.2-alpha02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-alpha02'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test:rules:1.1.1'
androidTestImplementation 'androidx.test:core-ktx:1.1.0'
implementation "com.vorlonsoft:androidrate:1.2.1"
implementation 'com.github.THEAccess:SuspendRx:1.0.10'
implementation 'com.github.THEAccess:privacydialog:0.1.0'
implementation 'com.google.android.material:material:1.1.0-alpha04'
implementation 'com.yqritc:android-scalablevideoview:1.0.4'
implementation 'com.timqi.sectorprogressview:library:2.0.1'
implementation 'com.github.Angtrim:Android-Five-Stars-Library:v3.1'
implementation 'com.stepstone.apprating:app-rating:2.3.0'
implementation 'com.google.firebase:firebase-dynamic-links:16.1.8'
implementation 'com.google.firebase:firebase-ads:16.0.1'
api ('com.google.android.ads.consent:consent-library:1.0.0') {
exclude module: 'androidx.activity'
}
//Navigation
implementation "android.arch.navigation:navigation-fragment-ktx:$nav_version"
implementation "android.arch.navigation:navigation-ui-ktx:$nav_version"
implementation 'io.reactivex.rxjava2:rxkotlin:2.3.0'
//Kodein
def kodein_version = "6.0.1"
implementation "org.kodein.di:kodein-di-generic-jvm:$kodein_version"
implementation "org.kodein.di:kodein-di-framework-android-x:$kodein_version"
implementation "org.kodein.di:kodein-di-conf-jvm:$kodein_version"
//Firebase
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-config:16.4.0'
implementation 'com.google.firebase:firebase-perf:16.2.4'
implementation 'com.google.firebase:firebase-firestore:18.1.0'
implementation 'com.google.firebase:firebase-auth:16.2.0'
implementation 'com.google.firebase:firebase-inappmessaging-display:17.1.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.9#aar') {
transitive = true;
}
implementation 'androidx.cardview:cardview:1.0.0'
}
Please help me understanding where the dependencies have duplicates
I had the same problem. Just using the Clean Project option and building it again worked for me...
It took me two days to fix it but here is the fix:
implementation ('com.google.android.ads.consent:consent-library:1.0.0') {
exclude group: 'androidx'
}

Gradle Multi module annotationProcessor compilation issue between Room Database And Glide Plugins

below is my build.gradle file dependencies
dependencies {
def room_version = "1.1.1"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.android.support:design:28.0.0-alpha1'
implementation 'com.github.siyamed:android-shape-imageview:0.9.+#aar'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:exifinterface:28.0.0'
implementation 'com.bignerdranch.android:expandablerecyclerview:3.0.0-RC1'
implementation('com.github.castorflex.verticalviewpager:library:19.0.1') {
exclude group: 'com.android.support'
exclude module: 'appcompat-v7'
exclude module: 'support-v4'
}
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'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
android {
useLibrary 'org.apache.http.legacy'
}
implementation("com.github.bumptech.glide:glide:4.8.0") {
exclude group: "com.android.support"
}
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation "android.arch.persistence.room:runtime:$room_version"
annotationProcessor "android.arch.persistence.room:compiler:$room_version"
}
I am using two plugin annotationProcessor one for Room database and other for Glide Plugin but as soon as i add annotationProcessor for Room Database. It seem GLide annotationProcessor is getting override and I am getting compilation error for Glide Plugin in my project. How to run both in my project ?
Make sure your root gradle look like this:
allprojects {
repositories {
jcenter()
google()
}

Paytabs android integration- Program type already present: okhttp3.Authenticator

I integrate PayTabs payment getaway in my project
it run correct on my debugging version
then get this error when generate signing apk from my project
this error appear when generate sign apk
and this is my gradle dependences
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:gridlayout-v7:26.1.0'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.github.siyamed:android-shape-imageview:0.9.+#aar'
implementation 'com.google.code.gson:gson:2.6.1'
implementation 'com.github.fccaikai:AndroidPermissionX:1.0.0'
implementation 'com.googlecode.android-query:android-query:0.25.9'
implementation 'com.wang.avi:library:2.1.3'
implementation 'com.github.rrsystems:utilsplus:1.1.0'
implementation 'com.romandanylyk:pageindicatorview:0.0.7'
implementation 'com.github.ragunathjawahar:android-saripaar:android-saripaar-2.0.3'
implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'jp.wasabeef:picasso-transformations:2.2.1'
implementation 'com.github.chrisbanes:PhotoView:1.3.1'
implementation 'com.facebook.fresco:fresco:1.8.0'
implementation 'com.github.stfalcon:frescoimageviewer:0.5.0'
implementation 'com.intuit.sdp:sdp-android:1.0.4'
implementation 'com.intuit.ssp:ssp-android:1.0.4'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'io.nlopez.smartlocation:library:3.3.1'
implementation project(':PayTabs_SDK')
I also got same problem after long research fortunately i find solution and here it's
configurations {
all*.exclude group: 'com.squareup.okio'
all*.exclude group: 'com.squareup.okhttp3'
all*.exclude group: 'com.android.support', module : 'support-v13'
}
Just put this code in app folder build.gradle file, it's look like
configurations {
all*.exclude group: 'com.squareup.okio'
all*.exclude group: 'com.squareup.okhttp3'
all*.exclude group: 'com.android.support', module : 'support-v13'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.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'
implementation 'com.squareup.retrofit2:retrofit:2.2.0'
implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
implementation project(':paytabs_SDK')
}
Paytabs SDK is using okhttp jar file, you can exclude okhttp by configuration
android {
configurations {
all*.exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}
}
https://github.com/JakeWharton/picasso2-okhttp3-downloader/issues/1#issuecomment-413993079

Categories

Resources