How to solve Firebase API initialization failure (Android + Firebase)

前端 未结 12 1296
渐次进展
渐次进展 2020-12-29 20:02

I recently needed to use Google GCM in my project. From its website it is said:

Firebase Cloud Messaging (FCM) is the new version of GCM. It inherits

12条回答
  •  伪装坚强ぢ
    2020-12-29 20:46

    Me, after struggle all night because my dependencies' version are the same. After adding Firebase Analytics, when I edited the code and run to my device my app crashed with Rejecting re-init on previously-failed class com.google.android.gms... I have to clean project and run again, then it worked fine but will be crashed again if I edit the code.

    My problem was caused by "useProguard false" from following this guide https://developer.android.com/studio/build/shrink-code.html

        debug {
            minifyEnabled true
            useProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
        }
    

    but I disabled Instant Run so remove "useProguard false" fixed my problem.

        debug {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
        }
    

提交回复
热议问题