0

Hello everyone I am building an app where I am using Firebase cloud messaging and Fused Location Provider, and when I put Fused Location Provider into app, I get this error for Firebase:

07-29 13:40:06.590 12635-12635/com.telnet.asp E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.google.firebase.FirebaseOptions
at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java)
at android.content.ContentProvider.attachInfo(ContentProvider.java)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java)
at android.app.ActivityThread.installContentProviders(ActivityThread.java)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java)
at android.app.ActivityThread.access$1400(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java)
at android.os.Handler.dispatchMessage(Handler.java)
at android.os.Looper.loop(Looper.java)
at android.app.ActivityThread.main(ActivityThread.java)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
at dalvik.system.NativeStart.main(Native Method)

This is my Gradle:

android {
    dexOptions {
        incremental = true;
        javaMaxHeapSize "4g"
    }
    compileSdkVersion 23
    buildToolsVersion "23.0.3"
    compileOptions.incremental = false

    defaultConfig {
        applicationId "com.telnet.asp"

        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"

        multiDexEnabled true

    }

    dataBinding {
        enabled = true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        testCompile 'junit:junit:4.12'
        apt 'com.google.dagger:dagger-compiler:2.2'
        provided 'javax.annotation:jsr250-api:1.0'
        compile project(path: ':domain')
        compile project(path: ':data')
        compile 'com.android.support:appcompat-v7:23.4.0'
        compile 'com.fasterxml.jackson.core:jackson-databind:2.7.0-rc2'
        compile 'com.android.support:design:23.4.0'
        compile 'javax.inject:javax.inject:1'
        compile 'com.squareup.retrofit2:retrofit:2.1.0'
        compile 'com.squareup.retrofit2:converter-gson:2.1.0'
        compile 'io.reactivex:rxandroid:1.2.1'
        compile 'io.reactivex:rxjava:1.1.6'
        compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
        compile 'com.google.dagger:dagger:2.2'
        compile 'com.android.support:support-v4:23.4.0'
        compile 'com.jakewharton:butterknife:6.1.0'
        compile 'net.danlew:android.joda:2.9.4.1'
        compile 'com.android.support:percent:23.4.0'
        compile 'com.squareup.picasso:picasso:2.5.2'
        compile 'com.google.firebase:firebase-messaging:9.0.0'
        compile 'com.google.android.gms:play-services:9.0.0'
     }
    apply plugin: 'com.google.gms.google-services'

What is my mistake and how can I fix it? EDIT: When I downgrade google play services to 8.4.0 I get this error:

 Error:Execution failed for task ':presentation:processDebugGoogleServices'.
> 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.
Bob Snyder
  • 37,759
  • 6
  • 111
  • 158
  • Possible duplicate of http://stackoverflow.com/questions/37360126/getting-exception-java-lang-noclassdeffounderror-com-google-firebase-firebaseop – Jay Rathod Jul 29 '16 at 12:00
  • @Atenica Try [this](http://stackoverflow.com/a/38178935/5744335) solution. Let me know whether it works or not. – Arshak Jul 29 '16 at 12:04
  • @Arshak Downgrading seems like a bad solution... What if you wanted to use a newer API feature? – OneCricketeer Jul 29 '16 at 12:53
  • I think the problem is that you don't need all the play services. Please see this page about how to selectively compile the APIs you need. https://developers.google.com/android/guides/setup#split – OneCricketeer Jul 29 '16 at 12:54
  • @Atenica Downgrading is a temporary solution for now. This issue will be fixed in their upcoming update. – Arshak Jul 29 '16 at 12:59
  • I edited my post, please take a look –  Jul 29 '16 at 13:23
  • @Atenica Try [this](http://stackoverflow.com/a/34375483/5744335) solution. – Arshak Jul 29 '16 at 17:10
  • This error can be an indication that the device has an old version of Google Play services. What version of Google Play services is installed on the device? Should be 9.2.x – Arthur Thompson Jul 31 '16 at 03:53

1 Answers1

0

I think you have to use 'com.google.firebase:firebase-ads:9.0.2' instead of play services 'com.google.android.gms:play-services:9.0.0' Here's the info https://firebase.google.com/docs/android/setup#add_the_sdk

Naveen
  • 830
  • 9
  • 19