Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter App Crashes on Startup

My flutter application is crashing on startup on android. I have taken away the google_sign_in and location packages. Now it seems to work. From what I'm reading I believe is has to do with these packages depending on different versions of google play services; however, I'm a little new to flutter, and I don't know how to resolve that issue.

I get a stack trace with an error message similar to this:

    08-17 09:56:13.668 1740-1745/? E/MP-Decision: num online cores: 2 reqd : 4 available : 4 rq_depth:7.700000 hotplug_avg_load_dw: 184
    UP cpu:1 core_idx:1 Nw:1.900000 Tw:140 total_time_up:0.000000
    UP cpu:2 core_idx:2 Nw:2.700000 Tw:90 total_time_up:91.000000
    UP cpu:3 core_idx:3 Nw:3.500000 Tw:90 total_time_up:91.000000
08-17 09:56:13.838 6267-6273/? E/jdwp: Failed sending reply to debugger: Bad file number
08-17 09:56:14.069 1740-1745/? E/MP-Decision: num online cores: 4 reqd : 1 available : 4 rq_depth:0.600000 hotplug_avg_load_dw: 21
    DOWN cpu:3 core_idx:3 Ns:3.100000 Ts:240 total_time_down:245.000000
    DOWN cpu:2 core_idx:2 Ns:2.100000 Ts:240 total_time_down:245.000000
    DOWN cpu:1 core_idx:1 Ns:1.100000 Ts:190 total_time_down:196.000000
08-17 09:56:14.319 1740-1745/? E/MP-Decision: num online cores: 1 reqd : 2 available : 4 rq_depth:1.700000 hotplug_avg_load_dw: 67
    UP cpu:1 core_idx:1 Nw:1.900000 Tw:140 total_time_up:0.000000
08-17 09:56:14.439 5011-5025/? E/QcrilMsgTunnelSocket: IOExceptionjava.io.IOException: No such file or directoryReason: No such file or directory
08-17 09:56:14.819 1740-1745/? E/MP-Decision: num online cores: 2 reqd : 1 available : 4 rq_depth:1.000000 hotplug_avg_load_dw: 15
    DOWN cpu:1 core_idx:1 Ns:1.100000 Ts:190 total_time_down:245.000000
08-17 09:56:15.120 1740-1745/? E/MP-Decision: num online cores: 1 reqd : 2 available : 4 rq_depth:1.300000 hotplug_avg_load_dw: 67
    UP cpu:1 core_idx:1 Nw:1.900000 Tw:140 total_time_up:0.000000
08-17 09:56:15.520 1740-1745/? E/MP-Decision: num online cores: 2 reqd : 3 available : 4 rq_depth:4.800000 hotplug_avg_load_dw: 94
    UP cpu:1 core_idx:1 Nw:1.900000 Tw:140 total_time_up:0.000000
    UP cpu:2 core_idx:2 Nw:2.700000 Tw:90 total_time_up:98.000000
08-17 09:56:15.550 6332-6332/com.jeepapp.jeepapp E/AndroidRuntime: FATAL EXCEPTION: main
    java.lang.NoClassDefFoundError: com.google.android.gms.common.internal.zzbq
        at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
        at android.app.ActivityThread.installProvider(ActivityThread.java:4995)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:4608)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4548)
        at android.app.ActivityThread.access$1400(ActivityThread.java:151)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1341)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:5293)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
        at dalvik.system.NativeStart.main(Native Method)
08-17 09:56:15.570 1740-1745/? E/MP-Decision: num online cores: 3 reqd : 4 available : 4 rq_depth:4.300000 hotplug_avg_load_dw: 186
    UP cpu:1 core_idx:1 Nw:1.900000 Tw:140 total_time_up:0.000000
    UP cpu:2 core_idx:2 Nw:2.700000 Tw:90 total_time_up:0.000000
    UP cpu:3 core_idx:3 Nw:3.500000 Tw:90 total_time_up:95.000000
08-17 09:56:15.820 1740-1745/? E/MP-Decision: num online cores: 4 reqd : 2 available : 4 rq_depth:1.000000 hotplug_avg_load_dw: 77
    DOWN cpu:3 core_idx:3 Ns:3.100000 Ts:240 total_time_down:242.000000
    DOWN cpu:2 core_idx:2 Ns:2.100000 Ts:240 total_time_down:242.000000
08-17 09:56:15.900 726-812/? E/android.os.Debug: !@Dumpstate > sdumpstate -k -t -z -d -o /data/log/dumpstate_app_error
08-17 09:56:15.920 1740-1745/? E/MP-Decision: num online cores: 2 reqd : 3 available : 4 rq_depth:3.300000 hotplug_avg_load_dw: 89
    UP cpu:1 core_idx:1 Nw:1.900000 Tw:140 total_time_up:0.000000
    UP cpu:2 core_idx:2 Nw:2.700000 Tw:90 total_time_up:92.000000
08-17 09:56:16.371 1740-1745/? E/MP-Decision: num online cores: 3 reqd : 2 available : 4 rq_depth:2.000000 hotplug_avg_load_dw: 30
    DOWN cpu:2 core_idx:2 Ns:2.100000 Ts:240 total_time_down:245.000000
08-17 09:56:16.471 1740-1745/? E/MP-Decision: num online cores: 2 reqd : 1 available : 4 rq_depth:0.300000 hotplug_avg_load_dw: 17
    DOWN cpu:1 core_idx:1 Ns:1.100000 Ts:190 total_time_down:96.000000
08-17 09:56:17.182 1740-1745/? E/MP-Decision: num online cores: 1 reqd : 2 available : 4 rq_depth:0.000000 hotplug_avg_load_dw: 52
    UP cpu:1 core_idx:1 Nw:1.900000 Tw:140 total_time_up:0.000000
08-17 09:56:18.112 6384-6384/? E/QSEECOMAPI:: Error::Failed to open /dev/qseecom device
08-17 09:56:18.112 6384-6384/? E/QSEECOMAPI:: Error::Failed to open /dev/qseecom device
08-17 09:56:18.112 6384-6384/? E/QSEECOMAPI:: Error::Failed to open /dev/qseecom device
08-17 09:56:18.112 6384-6384/? E/QSEECOMAPI:: Error::Failed to open /dev/qseecom device
08-17 09:56:18.112 6384-6384/? E/QSEECOMAPI:: Error::Failed to open /dev/qseecom device
08-17 09:56:18.213 1740-1745/? E/MP-Decision: num online cores: 2 reqd : 1 available : 4 rq_depth:1.000000 hotplug_avg_load_dw: 26
    DOWN cpu:1 core_idx:1 Ns:1.100000 Ts:190 total_time_down:245.000000
08-17 09:56:18.453 5011-5025/? E/QcrilMsgTunnelSocket: IOExceptionjava.io.IOException: No such file or directoryReason: No such file or directory
08-17 09:56:18.663 1740-1745/? E/MP-Decision: num online cores: 1 reqd : 3 available : 4 rq_depth:5.800000 hotplug_avg_load_dw: 69
    UP cpu:1 core_idx:1 Nw:1.900000 Tw:140 total_time_up:147.000000
    UP cpu:2 core_idx:2 Nw:2.700000 Tw:90 total_time_up:147.000000
08-17 09:56:19.013 1740-1745/? E/MP-Decision: num online cores: 3 reqd : 4 available : 4 rq_depth:3.500000 hotplug_avg_load_dw: 107
    UP cpu:1 core_idx:1 Nw:1.900000 Tw:140 total_time_up:0.000000
    UP cpu:2 core_idx:2 Nw:2.700000 Tw:90 total_time_up:0.000000
    UP cpu:3 core_idx:3 Nw:3.500000 Tw:90 total_time_up:98.000000
08-17 09:56:19.264 1740-1745/? E/MP-Decision: num online cores: 4 reqd : 2 available : 4 rq_depth:1.300000 hotplug_avg_load_dw: 91
    DOWN cpu:3 core_idx:3 Ns:3.100000 Ts:240 total_time_down:242.000000
    DOWN cpu:2 core_idx:2 Ns:2.100000 Ts:240 total_time_down:242.000000
08-17 09:56:19.364 1740-1745/? E/MP-Decision: num online cores: 2 reqd : 3 available : 4 rq_depth:4.800000 hotplug_avg_load_dw: 90
    UP cpu:1 core_idx:1 Nw:1.900000 Tw:140 total_time_up:0.000000
    UP cpu:2 core_idx:2 Nw:2.700000 Tw:90 total_time_up:92.000000
08-17 09:56:19.774 1740-1745/? E/MP-Decision: num online cores: 3 reqd : 2 available : 4 rq_depth:0.000000 hotplug_avg_load_dw: 133
    DOWN cpu:2 core_idx:2 Ns:2.100000 Ts:240 total_time_down:396.000000
08-17 09:56:20.265 1740-1745/? E/MP-Decision: num online cores: 2 reqd : 1 available : 4 rq_depth:0.500000 hotplug_avg_load_dw: 24
    DOWN cpu:1 core_idx:1 Ns:1.100000 Ts:190 total_time_down:196.000000
08-17 09:56:22.487 5011-5025/? E/QcrilMsgTunnelSocket: IOExceptionjava.io.IOException: No such file or directoryReason: No such file or directory
08-17 09:56:22.737 1740-1745/? E/MP-Decision: num online cores: 1 reqd : 3 available : 4 rq_depth:15.300000 hotplug_avg_load_dw: 56
    UP cpu:1 core_idx:1 Nw:1.900000 Tw:140 total_time_up:142.000000
    UP cpu:2 core_idx:2 Nw:2.700000 Tw:90 total_time_up:142.000000
08-17 09:56:22.787 1740-1745/? E/MP-Decision: num online cores: 3 reqd : 4 available : 4 rq_depth:8.900000 hotplug_avg_load_dw: 217
    UP cpu:1 core_idx:1 Nw:1.900000 Tw:140 total_time_up:0.000000
    UP cpu:2 core_idx:2 Nw:2.700000 Tw:90 total_time_up:0.000000
    UP cpu:3 core_idx:3 Nw:3.500000 Tw:90 total_time_up:186.000000

Also, to give you an idea of my pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  flutter_map:
  location:
  google_sign_in:
  firebase_auth: 0.5.4

Once I give rid of the google_sign_in and location dependencies it no longer crashes on start up. I'm guessing I need to set the versions of location and google_sign_in or find a way to set their google play dependency, but I'm not sure how to do either.

Also, I have the following in my build.gradle in the android folder:

 buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:3.2.1'
    }
}
like image 448
Cody Short Avatar asked Aug 17 '18 14:08

Cody Short


2 Answers

Add these lines at the end of your app/build.gradle file

 apply plugin: 'com.google.gms.google-services'

 configurations.all {
    resolutionStrategy {
        force 'com.google.android.gms:play-services-location:15.0.0'
     }
 }

Update your firebase_auth dependency:

firebase_auth: 0.5.18
like image 186
diegoveloper Avatar answered Oct 03 '22 11:10

diegoveloper


try adding

<meta-data android:name="flutterEmbedding" android:value="2" />

to your xml file.
This will make it look like this `

<application
    android:name="io.flutter.app.FlutterApplication"
    android:label="gscwa"
    android:icon="@mipmap/ic_launcher">
    <activity
        android:name=".MainActivity"
        android:launchMode="singleTop"
        android:theme="@style/LaunchTheme"
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
        android:hardwareAccelerated="true"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
    <!-- Don't delete the meta-data below.
         This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
    <meta-data
        android:name="flutterEmbedding"
        android:value="2" />
</application>

`

like image 45
Sarthak Singhal Avatar answered Oct 03 '22 10:10

Sarthak Singhal