简体   繁体   English

在Android上首次使用ClassNotFoundException打开Flutter应用程序时崩溃

[英]Flutter app crashing when opening first time with ClassNotFoundException on Android

My flutter app is crashing when opening first time after installing from play store. 从Play商店安装后首次打开时,我的flutter应用程序崩溃了。 After that it is working fine. 之后,它工作正常。 Below is the crash report 以下是当机报告

java.lang.NoClassDefFoundError: 
  at com.google.android.gms.internal.zzccn.<init> (Unknown Source:3)
  at com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver.onReceive (Unknown Source:6)
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:3273)
  at android.app.ActivityThread.-wrap17 (Unknown Source)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1690)
  at android.os.Handler.dispatchMessage (Handler.java:105)
  at android.os.Looper.loop (Looper.java:164)
  at android.app.ActivityThread.main (ActivityThread.java:6592)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:240)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:769)
Caused by: java.lang.ClassNotFoundException: 
  at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:93)
  at java.lang.ClassLoader.loadClass (ClassLoader.java:379)
  at java.lang.ClassLoader.loadClass (ClassLoader.java:312)

Is this related to FCM messaging? 这与FCM消息传递有关吗? The error is saying ClassNotFound but, if it is because of missing java class, then how it is working from second time onwards? 错误是说ClassNotFound,但是,如果是由于缺少java类,那么从第二次开始它是如何工作的?

请注意,如果MainActivity类的包与AndroidManifest.xml中的属性包匹配,请再次检查android / src / main / java。

I also had this problem, just update com.google.gms: google-services: 3.2.1 to com.google.gms: google-services: 4.2.0 there in "Android\\App\\build.grandle" that goes the problem. 我也遇到了这个问题,只需将com.google.gms:google-services:3.2.1更新为com.google.gms:google-services:4.2.0即可解决问题的“ Android \\ App \\ build.grandle”中。

For more information: Problem reported in github 有关更多信息: github中报告的问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM