Flutter应用在启动时崩溃

时间:2018-08-17 14:31:58

标签: dart google-play-services flutter

我的flutter应用程序在Android上启动时崩溃。我已经带走了google_sign_in和位置包。现在看来可行。从我阅读的内容来看,我相信这与这些程序包有关,具体取决于Google Play服务的不同版本;但是,我还是有点陌生​​,我也不知道该如何解决这个问题。

我得到一个堆栈跟踪,并带有类似于以下的错误消息:

    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

另外,让您了解我的pubspec.yaml:

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

一旦我摆脱了google_sign_in和位置依赖关系,它就不会在启动时崩溃。我猜我需要设置location和google_sign_in的版本,或者找到一种方法来设置其对Google Play的依赖性,但是我不确定该怎么做。

此外,我在android文件夹的build.gradle中具有以下内容:

 buildscript {
    repositories {
        google()
        jcenter()
    }

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

2 个答案:

答案 0 :(得分:3)

app/build.gradle文件的末尾添加这些行

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

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

更新您的firebase_auth依赖项:

firebase_auth: 0.5.18

答案 1 :(得分:1)

尝试添加

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

到您的xml文件。
这将使其看起来像这样 `

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

`