简体   繁体   中英

Flutter release apk crash on launch

I am having an issue testing a release build on my device. If I use the app using flutter run or flutter run --release , the app runs with no errors reported and I can use the app without issue. However, using the generated APK from flutter build apk , the app crashes immediately stating the app failed to launch.

I have followed everything from here https://flutter.dev/docs/deployment/android#building-the-app-for-release so that shouldn't be the issue.

How do I begin to debug this issue?

This is the output from Flutter Doctor -v

[✓] Flutter (Channel stable, 1.20.4, on Mac OS X 10.15.7 19H2, locale en-GB)
    • Flutter version 1.20.4 at /Users/student/flutter
    • Framework revision fba99f6cf9 (3 weeks ago), 2020-09-14 15:32:52 -0700
    • Engine revision d1bc06f032
    • Dart version 2.9.2

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/student/Library/Android/sdk
    • Platform android-29, build-tools 29.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0.1, Build version 12A7300
    • CocoaPods version 1.9.1

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 49.0.2
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.49.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.15.0

With release mode. You can debug what's going on with https://fbflipper.com . Just download Flipper tool, install and run it and watch the logs. Anyway, you can consider my points about android crash:

  • Wrong arch: check architecture supported between apk and device
  • Check broken in native libraries or class not found: Some libraries broken reference in release with ProGuard
  • Manifest broken: Some thing kind of missing or incorrect in configuration of manifest file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM