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

求助:应用运行崩溃,报FirebaseInitProvider类未找到错误

Fixing java.lang.ClassNotFoundException: com.google.firebase.provider.FirebaseInitProvider

Hey there, sorry to hear you're stuck with this persistent crash—let's walk through the most common fixes for this Firebase-related error. First, let's restate the error you're seeing for clarity:

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/hushtagstudios.com.towme-BBa4eyXyMhsunbzMgepCFg==/base.apk", zip file "/data/app/hushtagstudios.com.towme-BBa4eyXyMhsunbzMgepCFg==/split_lib_dependencies_apk.apk", zip file "/data/...

Here are the steps to troubleshoot and resolve this:

  • Verify Firebase dependency setup
    Double-check your app/build.gradle file to make sure you have the core Firebase dependency included (use the latest version available):

    implementation 'com.google.firebase:firebase-core:21.1.1'
    

    Also confirm your project-level build.gradle has the Google Services plugin in the dependencies block:

    classpath 'com.google.gms:google-services:4.3.15'
    

    And don't forget to apply the plugin at the bottom of your app/build.gradle:

    apply plugin: 'com.google.gms.google-services'
    
  • Enable MultiDex if needed
    This error often pops up when your app exceeds the 64k method limit. To fix this:

    1. Enable MultiDex in app/build.gradle:
      android {
          defaultConfig {
              multiDexEnabled true
          }
      }
      
    2. Add the MultiDex dependency:
      implementation 'androidx.multidex:multidex:2.0.1'
      
    3. If you have a custom Application class, make it extend MultiDexApplication instead of Application. If you can't extend it, override attachBaseContext:
      @Override
      protected void attachBaseContext(Context base) {
          super.attachBaseContext(base);
          MultiDex.install(this);
      }
      
  • Clean and rebuild your project
    Sometimes cached build files cause issues. Try these steps:

    1. In Android Studio, go to File > Invalidate Caches / Restart and confirm the action.
    2. Run the clean command from the terminal:
      ./gradlew clean
      
    3. Rebuild your project with:
      ./gradlew assembleDebug
      
  • Check your Firebase configuration file
    Ensure the google-services.json file is placed directly in the app/ directory of your project, not in a subfolder. Also verify that the package_name field in the JSON matches your app's exact package name (case-sensitive!).

If none of these steps work, feel free to share more details like your gradle files or any recent changes you made to the project—we can dig deeper!

内容的提问来源于stack exchange,提问作者Car Network

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.25 06:57:08