【发布时间】:2018-10-22 04:20:20
【问题描述】:
我有一个非常有趣的问题,我可以在模拟器上很好地运行我的应用程序,flutter build apk 成功,我可以在 Google Play 上发布新版本或者只是在我的手机上安装apk(Pixel 2 XL,目前在 4 月的安全补丁中)。
但是当我在手机上启动它时,它会立即崩溃。我还没有尝试安装debug apk,首先我想应用五月补丁。
我已经尝试过多次升级颤振,但似乎也没有任何问题:
C:\Android\osszefogasaszanhuzokert>flutter upgrade
Upgrading Flutter from c:\Android\flutter...
From https://github.com/flutter/flutter
3d3673a34..23098dde5 master -> origin/master
Already up to date.
Upgrading engine...
Already up-to-date.
Flutter 0.3.6-pre.81 • channel beta • https://github.com/flutter/flutter.git
Framework • revision 2849bc04ff (10 days ago) • 2018-05-01 20:07:45 -0700
Engine • revision d5c1117170
Tools • Dart 2.0.0-dev.52.0.flutter-011676641a
Running "flutter packages upgrade" in osszefogasaszanhuzokert... 14.4s
Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.3.6-pre.81, on Microsoft Windows [Version 10.0.15063], locale en-GB)
[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[√] Android Studio (version 3.1)
[√] Connected devices (1 available)
• No issues found!
我最近更换了笔记本电脑,并在这台新笔记本电脑上查看了我的代码的 git 存储库。有一些问题,但我最终解决了这些问题。唯一的区别是现在的项目名称只是osszefogasaszanhuzokert,而包名称是osszefogasaszanhuzokert2 - 但我认为这不会造成任何问题。
我的猜测是问题出在我的AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.zgyorkei.osszefogasaszanhuzokert2">
<!-- The INTERNET permission is required for development. Specifically,
flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="Összefogás A Szánhúzókért"
android:icon="@mipmap/ic_launcher">
<activity
android:name="com.zgyorkei.osszefogasaszanhuzokert2.MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in @style/LaunchTheme). -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
Android Studio 将几个属性标记为不允许,但正如您所见,我几乎将所有属性都保留为默认值 - 除了我出于明显的原因更改了 android:label。
编辑:我安装了调试 apk,它运行良好。但是,我能够得到发布apk崩溃的adb logcat,问题似乎如下:
05-12 07:38:23.341 29595 29595 I crash_dump32: performing dump of process 29560 (target tid = 29560)
05-12 07:38:23.341 29595 29595 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
05-12 07:38:23.341 29595 29595 F DEBUG : Build fingerprint: 'google/taimen/taimen:8.1.0/OPM2.171019.029.B1/4720900:user/release-keys'
05-12 07:38:23.341 29595 29595 F DEBUG : Revision: 'rev_10'
05-12 07:38:23.341 29595 29595 F DEBUG : ABI: 'arm'
05-12 07:38:23.341 29595 29595 F DEBUG : pid: 29560, tid: 29560, name: saszanhuzokert2 >>> com.zgyorkei.osszefogasaszanhuzokert2 <<<
05-12 07:38:23.342 29595 29595 F DEBUG : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
05-12 07:38:23.343 29595 29595 F DEBUG : Abort message: '[FATAL:flutter/runtime/dart_vm.cc(409)] Error while initializing the Dart VM: Snapshot not compatible with the current VM configuration: the snapshot requires 'product no-type_checks no-asserts no-error_on_bad_type no-error_on_bad_override arm-eabi hardfp' but the VM has 'product no-type_checks no-asserts no-error_on_bad_type no-error_on_bad_override arm-eabi softfp'
如何将Dart VM 更改为使用hardfp 而不是softfp?
【问题讨论】:
-
adb logcat,查看设备崩溃时打印的内容 - 这可能需要调试构建
-
感谢您的提示。调试 apk 就像我想要的那样在手机上工作,但是当我提取发布 apk 的 adb logcat 时,carsh 报告(添加到问题中)显示 Dart VM 使用 softfp 而不是 hardfp。据我所知,这是一些架构级别的东西,它可能是 Dart VM 的错误。或者我应该在 build.gradle 或 AndroidManifest.xml 中更改什么以强制使用 hardfp?
-
啊,可能是github.com/flutter/flutter/issues/17387。如果你切换到master,现在应该已经修复了
-
是的,这就是问题所在。谢谢! ;)
-
我也有同样的问题,尤其是 firebase 插件。我认为问题在于您使用的是什么版本的颤振以及 firebase 插件使用的是什么