You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

FirebaseInitProvider获取失败求助:应用启动时资源缺失报错

Hey there! Let’s dig into this FirebaseInitProvider error you’re hitting post-maintenance. Since you’ve already checked MultiDex and applicationId, let’s go through some other targeted fixes that might resolve this:

Common Fixes for "Unable to get provider com.google.firebase.provider.FirebaseInitProvider"
  • Align all Firebase dependency versions
    Mixed versions of Firebase libraries are a frequent culprit for this error. Ensure every Firebase-related dependency (like firebase-core, firebase-messaging) uses the same version. For easier management, use Firebase's BOM to auto-sync versions:

    implementation platform('com.google.firebase:firebase-bom:32.7.0') // Use the latest stable version
    implementation 'com.google.firebase:firebase-core'
    implementation 'com.google.firebase:firebase-messaging'
    
  • Double-check MultiDex setup completeness
    Even if you enabled MultiDex, small configuration gaps can cause issues:

    • Confirm multiDexEnabled true is in your defaultConfig block in app-level build.gradle
    • If your minSdkVersion is below 21, add the MultiDex dependency:
      implementation 'androidx.multidex:multidex:2.0.1'
      
    • If you have a custom Application class, either extend MultiDexApplication or add this override:
      @Override
      protected void attachBaseContext(Context base) {
          super.attachBaseContext(base);
          MultiDex.install(this);
      }
      
    • Don’t forget to reference this custom class in your AndroidManifest.xml
  • Wipe caches and rebuild from scratch
    Post-maintenance cache conflicts are common. Try these steps:

    • Run Build > Clean Project then Build > Rebuild Project in Android Studio
    • Go to File > Invalidate Caches... and select "Invalidate and Restart"
    • Delete the .gradle folder at your project root and the build folder in your app module, then re-build
  • Validate Firebase configuration files
    Make sure your google-services.json is in the app/src/main directory and matches your Firebase project’s current settings (especially package_name and client IDs). If you updated your Firebase project recently, re-download this file and replace the old one. Also confirm the Google Services plugin is applied correctly:

    • In your project-level build.gradle:
      dependencies {
          classpath 'com.google.gms:google-services:4.4.0' // Latest stable version
      }
      
    • Add apply plugin: 'com.google.gms.google-services' at the end of your app-level build.gradle
  • Fix ProGuard/R8 obfuscation issues
    If you’re using obfuscation, Firebase classes might be getting stripped. Add these rules to your proguard-rules.pro:

    -keep class com.google.firebase.provider.FirebaseInitProvider { *; }
    -keep class com.google.firebase.** { *; }
    -keep class com.google.android.gms.** { *; }
    

    You can also temporarily disable obfuscation to test if this is the root cause.

  • Verify Manifest entries
    Check if the FirebaseInitProvider is present in your merged Manifest (found at app/build/intermediates/manifests/full/debug/AndroidManifest.xml). It should look like this:

    <provider
        android:name="com.google.firebase.provider.FirebaseInitProvider"
        android:authorities="${applicationId}.firebaseinitprovider"
        android:exported="false"
        android:initOrder="100" />
    

    If it’s missing, try re-adding your Firebase dependencies or manually inserting the entry.

内容的提问来源于stack exchange,提问作者Mwikala Kangwa

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 04:15:38