Getting Exception java.lang.NoClassDefFoundError: com.google.firebase.FirebaseOptions after updating to the new firebase

后端 未结 15 1663
渐次进展
渐次进展 2020-11-22 09:56

I have updated my application to the new firebase using the this and now when i compile my project i get the following exception.

Here is my logcat:

15条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-22 10:31

    It is so simple to fix guys.If you are using player-services and firebase both in your project make sure that you don't import all the available services in the google.Just import the APIs what you actually need. For example:

     compile 'com.google.firebase:firebase-messaging:9.2.0'
     compile 'com.google.android.gms:play-services:9.2.0'
    

    Doing this way it can give you noclassdeffounderror .To fix this

    remove play-services and sync your project. If you have dependency like using ads or maps in your app then define the specific API. like:

    compile 'com.google.android.gms:play-services-maps:9.2.0'
    

    Note: Maximum don't try to use multiDexEnabled true. This should be your last step to fix something.

    Hope this is helpful.

提交回复
热议问题