Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems using newest version of firebase

Sorry for having opened another question about this issue. I have followed all the suggested solutions in the old questions but it still does not work. I get the error:

Error:Execution failed for task ':app:processTravelrepublicDebugGoogleServices'.

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 9.0.0.

If I switch back to 9.0.0 for the google-play-services then I get the error:

A/FirebaseApp: Firebase API initialization failure.
    java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.google.firebase.FirebaseApp.zza(Unknown Source)
        at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
        at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
        at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
        at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1716)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1685)
        at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
        at android.app.ActivityThread.installProvider(ActivityThread.java:5555)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5150)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5090)
        at android.app.ActivityThread.access$1600(ActivityThread.java:177)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1509)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:145)
        at android.app.ActivityThread.main(ActivityThread.java:5938)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
     Caused by: java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.<init>()' is inaccessible to class 'com.google.firebase.iid.zzg' (declaration of 'com.google.firebase.iid.zzg' appears in /data/data/uk.co.travelrepublic.travelrepublic/files/instant-run/dex/slice-com.google.firebase-firebase-iid-9.0.0_66d82148183e76f632e6315cc053cb13ba717e05-classes.dex)
        at com.google.firebase.iid.zzg.zzeC(Unknown Source)
        at com.google.firebase.iid.zzg.<init>(Unknown Source)
        at com.google.firebase.iid.zzg.<init>(Unknown Source)
        at com.google.firebase.iid.zzd.zzb(Unknown Source)
        at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
        at java.lang.reflect.Method.invoke(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:372) 
        at com.google.firebase.FirebaseApp.zza(Unknown Source) 
        at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
        at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
        at com.google.firebase.FirebaseApp.zzbu(Unknown Source) 
        at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) 
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1716) 
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1685) 
        at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
        at android.app.ActivityThread.installProvider(ActivityThread.java:5555) 
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5150) 
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5090) 
        at android.app.ActivityThread.access$1600(ActivityThread.java:177) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1509) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:145) 
        at android.app.ActivityThread.main(ActivityThread.java:5938) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:372) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195) 

This is an extract of my build.gradle

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
        mavenCentral()
    }
    dependencies {
        classpath 'io.fabric.tools:gradle:1.20.1'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'me.tatarka:gradle-retrolambda:3.3.1'

    }
}

repositories {
    maven { url 'https://maven.fabric.io/public' }
    mavenCentral()
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'me.tatarka.retrolambda'

android {
    compileSdkVersion 25
    buildToolsVersion '24.0.2'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
...
}

dependencies {

    configurations.all {
        resolutionStrategy {
            force "com.android.support:design:$supportVersion"
            force "com.android.support:support-v4:$supportVersion"
            force "com.android.support:appcompat-v7:$supportVersion"
        }
    }

    compile fileTree(dir: 'libs', include: ['*.jar'])

    def supportVersion = '25.1.0'
    compile "com.android.support:appcompat-v7:$supportVersion"
    compile "com.android.support:design:$supportVersion"
    compile "com.android.support:support-v4:$supportVersion"
    compile "com.android.support:cardview-v7:$supportVersion"
    compile "com.android.support:recyclerview-v7:$supportVersion"
    compile "com.android.support:support-annotations:$supportVersion"
    compile "com.android.support:palette-v7:$supportVersion"
    compile "com.android.support:support-v4:$supportVersion"

    def playService = '9.8.0'
    compile "com.google.android.gms:play-services-ads:$playService"
    compile "com.google.android.gms:play-services-plus:$playService"
    compile "com.google.android.gms:play-services-maps:$playService"
    compile "com.google.android.gms:play-services-gcm:$playService"
    compile "com.google.android.gms:play-services-analytics:$playService"
    compile "com.google.android.gms:play-services-auth:$playService"

    compile "com.google.firebase:firebase-core:$playService"

    compile('com.crashlytics.sdk.android:crashlytics:2.5.3@aar') {
        transitive = true;
    }

    provided 'com.google.auto.value:auto-value:1.2'
    apt 'com.google.auto.value:auto-value:1.2'
    apt 'com.ryanharter.auto.value:auto-value-parcel:0.2.3-rc2'
    apt 'com.ryanharter.auto.value:auto-value-gson:0.3.2-rc1'
    apt 'com.jakewharton:butterknife-compiler:8.0.1'

    apt 'com.google.dagger:dagger-compiler:2.7'
    compile 'com.google.dagger:dagger:2.7'
    provided 'javax.annotation:jsr250-api:1.0'

    debugCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
    releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
    testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'

    def retrofit2 = '2.1.0'
    def okhttp3 = '3.4.1'

    compile "com.squareup.retrofit2:retrofit:$retrofit2"
    compile "com.squareup.retrofit2:adapter-rxjava:$retrofit2"
    compile "com.squareup.retrofit2:converter-gson:$retrofit2"
    compile "com.squareup.okhttp3:okhttp:$okhttp3"
    compile "com.squareup.okhttp3:okhttp-urlconnection:$okhttp3"
    compile "com.squareup.okhttp3:logging-interceptor:$okhttp3"

    // dependencies for testing
    def hamcrestVersion = '1.3'

    // matchers
    testCompile "org.hamcrest:hamcrest-core:$hamcrestVersion"
    testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
    testCompile "org.hamcrest:hamcrest-integration:$hamcrestVersion"

    testCompile 'junit:junit:4.12'
    testCompile 'org.mockito:mockito-core:1.10.19'

    // Android instrumentation
    androidTestCompile 'junit:junit:4.12'
    androidTestCompile "com.android.support:support-annotations:$supportVersion"
    androidTestCompile "org.hamcrest:hamcrest-core:$hamcrestVersion"
    androidTestCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
    androidTestCompile "org.hamcrest:hamcrest-integration:$hamcrestVersion"
    androidTestCompile 'org.mockito:mockito-core:1.10.19'
    androidTestCompile 'com.google.dexmaker:dexmaker:1.2'
    androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
    androidTestCompile 'com.android.support.test:runner:0.5'
    androidTestCompile 'com.android.support.test:rules:0.5'

    compile 'com.github.JakeWharton:ViewPagerIndicator:2.4.1'
    compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
    compile 'com.google.maps.android:android-maps-utils:0.3.3'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.facebook.android:facebook-android-sdk:4.10.0'
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.4.0'
    compile 'com.squareup.okhttp:okhttp:2.4.0'
    compile 'de.greenrobot:eventbus:2.4.0'
    compile 'com.squareup.picasso:picasso:2.4.0'
    compile 'joda-time:joda-time:2.5'
    compile 'com.j256.ormlite:ormlite-android:4.48'
    compile 'commons-codec:commons-codec:1.8'
    compile 'com.mixpanel.android:mixpanel-android:4.8.6'
    compile 'com.jakewharton:butterknife:8.0.1'
    compile 'com.appsflyer:af-android-sdk:4.3.7@aar'
}

apply plugin: 'com.google.gms.google-services'

The project level build.gradle is:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.google.gms:google-services:3.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}
like image 364
1048576 Avatar asked Dec 24 '22 22:12

1048576


1 Answers

Remove the plugin: 'com.google.gms.google-services' at the top of the file.

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
//apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'me.tatarka.retrolambda'

Also use the use the latest version of Google Play services 10.0.1

like image 56
Gabriele Mariotti Avatar answered Dec 28 '22 09:12

Gabriele Mariotti