After adding some firebase library in flutter android app crashing

 minSdkVersion 21
        targetSdkVersion 28

 dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.2.0'
    }

 cloud_firestore: ^0.8.2  
  firebase_core: ^0.2.5
  firebase_messaging: ^5.0.1

2019-05-08 12:41:40.484 16013-16013/? E/AndroidRuntime: FATAL EXCEPTION: main Process: myapp.com.myapp, PID: 16013 java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/internal/InternalTokenProvider; at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:453) at java.lang.Class.forName(Class.java:378) at com.google.firebase.components.ComponentDiscovery.instantiate(com.google.firebase:[email protected]@17.0.0:78) at com.google.firebase.components.ComponentDiscovery.discover(com.google.firebase:[email protected]@17.0.0:71) at com.google.firebase.FirebaseApp.(com.google.firebase:[email protected]@17.0.0:468) at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:[email protected]@17.0.0:354) at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:[email protected]@17.0.0:321) at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:[email protected]@17.0.0:305) at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:[email protected]@17.0.0:53) at android.content.ContentProvider.attachInfo(ContentProvider.java:1919) at android.content.ContentProvider.attachInfo(ContentProvider.java:1894) at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:[email protected]@17.0.0:47) at android.app.ActivityThread.installProvider(ActivityThread.java:6263) at android.app.ActivityThread.installContentProviders(ActivityThread.java:5829) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5737) at android.app.ActivityThread.-wrap1(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1659) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6518) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 2019-05-08 12:41:40.488 16013-16013/? E/AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.internal.InternalTokenProvider" on path: DexPathList[[zip file "/data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/base.apk", zip file "/data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_dependencies_apk.apk", zip file "/data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_resources_apk.apk", zip file "/data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_slice_0_apk.apk", zip file "/data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_slice_1_apk.apk", zip file "/data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_slice_2_apk.apk", zip file "/data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_slice_3_apk.apk", zip file "/data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_slice_4_apk.apk", zip file "/data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_slice_5_apk.apk", zip file "/data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_slice_6_apk.apk", zip file "/data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_slice_7_apk.apk", zip file "/data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_slice_8_apk.apk", zip file "/data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/lib/arm, /data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/base.apk!/lib/armeabi-v7a, /data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_dependencies_apk.apk!/lib/armeabi-v7a, /data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_resources_apk.apk!/lib/armeabi-v7a, /data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_slice_0_apk.apk!/lib/armeabi-v7a, /data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_slice_1_apk.apk!/lib/armeabi-v7a, /data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_slice_2_apk.apk!/lib/armeabi-v7a, /data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_slice_3_apk.apk!/lib/armeabi-v7a, /data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_slice_4_apk.apk!/lib/armeabi-v7a, /data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_slice_5_apk.apk!/lib/armeabi-v7a, /data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_slice_6_apk.apk!/lib/armeabi-v7a, /data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_slice_7_apk.apk!/lib/armeabi-v7a, /data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_slice_8_apk.apk!/lib/armeabi-v7a, /data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_slice_9_apk.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) ... 24 more Suppressed: java.io.IOException: No original dex files found for dex location /data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_resources_apk.apk at dalvik.system.DexFile.openDexFileNative(Native Method) at dalvik.system.DexFile.openDexFile(DexFile.java:353) at dalvik.system.DexFile.(DexFile.java:100) at dalvik.system.DexFile.(DexFile.java:74) at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374) at dalvik.system.DexPathList.makeDexElements(DexPathList.java:337) at dalvik.system.DexPathList.(DexPathList.java:157) at dalvik.system.BaseDexClassLoader.(BaseDexClassLoader.java:65) at dalvik.system.PathClassLoader.(PathClassLoader.java:64) at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73) at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88) 2019-05-08 12:41:40.491 16013-16013/? E/AndroidRuntime: at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:69) at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:35) at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:693) at android.app.LoadedApk.getClassLoader(LoadedApk.java:727) at android.app.LoadedApk.getResources(LoadedApk.java:954) at android.app.ContextImpl.createAppContext(ContextImpl.java:2270) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5654) ... 8 more Suppressed: java.io.IOException: No original dex files found for dex location /data/app/myapp.com.myapp-EPX9OHQHpG7_cpLXw2wCXQ==/split_lib_slice_7_apk.apk at dalvik.system.DexFile.openDexFileNative(Native Method) at dalvik.system.DexFile.openDexFile(DexFile.java:353) at dalvik.system.DexFile.(DexFile.java:100) at dalvik.system.DexFile.(DexFile.java:74) at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374) at dalvik.system.DexPathList.makeDexElements(DexPathList.java:337) at dalvik.system.DexPathList.(DexPathList.java:157) at dalvik.system.BaseDexClassLoader.(BaseDexClassLoader.java:65) at dalvik.system.PathClassLoader.(PathClassLoader.java:64) at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73) at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88) at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:69) at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:35) at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:693) at android.app.LoadedApk.getClassLoader(LoadedApk.java:727) at android.app.LoadedApk.getResources(LoadedApk.java:954) at android.app.ContextImpl.createAppContext(ContextImpl.java:2270) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5654) ... 8 more


Solution 1: Peter Haddad

Change this:

firebase_core: ^0.2.5

to the following:

firebase_core: ^0.4.0

Check here for latest changes:

https://pub.dev/packages/firebase_core#-changelog-tab-