【问题标题】:java.lang.ClassNotFoundException for FirebaseInitProvider with Android Studio in Windows deviceWindows 设备中带有 Android Studio 的 FirebaseInitProvider 的 java.lang.ClassNotFoundException
【发布时间】:2018-05-14 05:37:53
【问题描述】:

在 android 模拟器中运行应用程序时,应用程序会因运行时异常而崩溃,即 java.lang.ClassNotFoundException: 找不到类“com.google.firebase.provider.FirebaseInitProvider”

在 Windows 操作系统中使用 Android Studio 运行应用程序。当使用模拟器操作系统版本 6.0 运行应用程序时,模拟器操作系统版本 4.4、4.2、5.0.1 会发生此崩溃。

启用多索引

defaultConfig {
        .............
        .............   
        multiDexEnabled true

    } 

以及覆盖应用程序文件中的 attachBasecontex

protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }

请帮助解决问题。

提前致谢

【问题讨论】:

    标签: android windows android-studio-2.3


    【解决方案1】:

    将此代码放在应用程序标记(where we place activities etc) 的清单中

     <service android:name="paste your class name here and press ctrl+enter">
                <intent-filter>
                    <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
                </intent-filter>
            </service>
    

    【讨论】:

    • 我们还没有在项目中使用任何 Firebase 库。即使我遵循您的建议仍然遇到问题
    猜你喜欢
    • 1970-01-01
    • 2017-04-16
    • 2017-08-01
    • 2018-01-07
    • 2019-08-09
    • 2020-09-28
    • 2016-08-21
    • 2017-07-08
    • 1970-01-01
    相关资源
    最近更新 更多