我最近升级到Android Studio 2.2.2并迁移到新的Firebase SDK。通过此迁移,我不得不将google-services.json文件添加到我的应用中,以支持部分新的Firebase功能。
之前(在升级到2.2.2并迁移到新的Firebase之前),我能够毫无问题地运行我的应用程序。但是,我现在在尝试运行应用程序时立即收到以下错误:
Humanities
我能够修复"通过从我的清单中删除 --------- beginning of crash
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.troychuinard.fanpolls, PID: 12116
java.lang.RuntimeException: Unable to instantiate application com.troychuinard.fanpolls.FanPollsApplication: java.lang.ClassNotFoundException: Didn't find class "com.troychuinard.fanpolls.FanPollsApplication" on path: DexPathList[[zip file "/data/app/com.troychuinard.fanpolls-2/base.apk"],nativeLibraryDirectories=[/data/app/com.troychuinard.fanpolls-2/lib/x86, /vendor/lib, /system/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:578)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4680)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.troychuinard.fanpolls.FanPollsApplication" on path: DexPathList[[zip file "/data/app/com.troychuinard.fanpolls-2/base.apk"],nativeLibraryDirectories=[/data/app/com.troychuinard.fanpolls-2/lib/x86, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newApplication(Instrumentation.java:981)
at android.app.LoadedApk.makeApplication(LoadedApk.java:573)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4680)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Suppressed: java.lang.ClassNotFoundException: com.troychuinard.fanpolls.FanPollsApplication
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 12 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
属性来解决此问题:
一个:
新:(此方法有效):
我不确定这是否是正确的解决方法,因为我以前能够在我的清单中使用android:name
属性而没有任何问题。我试图找出导致此错误的原因以及我如何正确解决。