Search code examples
androidcrashflutterclassnotfoundexception

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. 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? The error is saying ClassNotFound but, if it is because of missing java class, then how it is working from second time onwards?


Solution

  • 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.

    For more information: Problem reported in github