我无法在发布模式下运行Flutter应用-android

时间:2019-10-14 16:52:49

标签: java android kotlin flutter dart

  1. 我无法在发布模式下运行Flutter应用。我尝试使用apk和bundletool进行构建,但出现了同样的错误“很遗憾,Hanoti已停止”
  2. 在调试模式下正常运行。
  3. 这是图像: the image of the issue
  4. 在调试模式下: the image in debug mode
  5. 我的应用文件:喜欢
    • android \ build.gradle:
    • android \ app \ build.gradle:
    • androidManifest.xml:
    • main.dart: ...等等。

  1. 我做了所有这些,然后运行了我的日志:
    • 干净整洁
    • gradlew cleanBuildCache

目标平台: Android 目标操作系统版本/浏览器: minSdkVersion 21(android 5.0),targetSdkVersion 28(android 9) 设备:galaxy_nexus_api_23:5554 =>模拟器 我的开发机器。

OS Name:                   Microsoft Windows 10 Enterprise
OS Version:                10.0.17763 N/A Build 17763
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Standalone Workstation
OS Build Type:             Multiprocessor Free
Registered Owner:          N/A
Registered Organization:   N/A
System Type:               x64-based PC
Processor(s):              1 Processor(s) Installed.
                           [01]: Intel64 Family 6 Model 142 Stepping 9 GenuineIntel ~2701 Mhz
Windows Directory:         C:\WINDOWS
System Directory:          C:\WINDOWS\system32
Boot Device:               \Device\HarddiskVolume1
System Locale:             en-us;English (United States)
Total Physical Memory:     8,092 MB
Available Physical Memory: 2,497 MB
Virtual Memory: Max Size:  13,468 MB
Virtual Memory: Available: 7,171 MB
Virtual Memory: In Use:    6,297 MB

日志

flutter run --verbose

https://gist.github.com/AttalliAyoub/c4572d6f80f616b3229789f2ddf32b6a#file-flutter-run-verbose

flutter构建apk --split-per-abi --verbose

https://gist.github.com/AttalliAyoub/c4572d6f80f616b3229789f2ddf32b6a#file-flutter-build-apk-split-per-abi-verbose

颤振分析

Analyzing hanoti...

   info - Unused import: 'package:hanoti/services/interfaces.dart' - lib\main.dart:9:8 - unused_import
   info - This class (or a class which this class inherits from) is marked as '@immutable', but one or
          more of its instance fields are not final: UserIcon._radius, UserIcon._border -
          lib\pages\chat.dart:155:7 - must_be_immutable
   info - The left operand uses '?.', so its value can be null - lib\pages\chat.dart:228:7 -
          null_aware_before_operator
   info - The value of the '?.' operator can be 'null', which isn't appropriate in a condition -
          lib\pages\chat.dart:288:26 - null_aware_in_condition
   info - This class (or a class which this class inherits from) is marked as '@immutable', but one or
          more of its instance fields are not final: PickChat._chatService - lib\pages\pickChat.dart:14:7
          - must_be_immutable
   info - Unused import: 'package:font_awesome_flutter/font_awesome_flutter.dart' -
          lib\pages\pickStore.dart:2:8 - unused_import
   info - The left operand uses '?.', so its value can be null - lib\pages\pickStore.dart:71:27 -
          null_aware_before_operator
   info - The left operand uses '?.', so its value can be null - lib\pages\products.dart:38:11 -
          null_aware_before_operator
   info - Close instances of `dart.core.Sink` - lib\pages\searchForStore.dart:32:27 - close_sinks
   info - The value of the local variable '_current' isn't used - lib\pages\showproduct.dart:21:9 -
          unused_local_variable
   info - Dead code - lib\pages\showproduct.dart:78:31 - dead_code
   info - Use `;` instead of `{}` for empty constructor bodies - lib\pages\storeInfo.dart:6:25 -
          empty_constructor_bodies
   info - Prefer using /// for doc comments - lib\pages\videoCall.dart:5:1 - slash_for_doc_comments
   info - Unused import: 'package:hanoti/services/resp.dart' - lib\pages\workspace.dart:9:8 -
          unused_import
   info - The value of the field '_profile' isn't used - lib\pages\workspace.dart:22:8 - unused_field
   info - The left operand uses '?.', so its value can be null - lib\pages\workspace.dart:59:11 -
          null_aware_before_operator
   info - The left operand uses '?.', so its value can be null - lib\pages\workspace.dart:257:7 -
          null_aware_before_operator
   info - Close instances of `dart.core.Sink` - lib\services\auth.dart:27:25 - close_sinks
   info - 'enablePersistence' is deprecated and shouldn't be used - lib\services\auth.dart:31:14 -
          deprecated_member_use
   info - 'enablePersistence' is deprecated and shouldn't be used - lib\services\chat.dart:10:14 -
          deprecated_member_use
   info - Name non-constant identifiers using lowerCamelCase - lib\services\interfaces.dart:22:10 -
          non_constant_identifier_names
   info - Name non-constant identifiers using lowerCamelCase - lib\services\interfaces.dart:23:10 -
          non_constant_identifier_names
   info - Name non-constant identifiers using lowerCamelCase - lib\services\interfaces.dart:24:10 -
          non_constant_identifier_names
   info - Name non-constant identifiers using lowerCamelCase - lib\services\interfaces.dart:25:10 -
          non_constant_identifier_names
   info - Name non-constant identifiers using lowerCamelCase - lib\services\interfaces.dart:26:10 -
          non_constant_identifier_names
   info - Name non-constant identifiers using lowerCamelCase - lib\services\interfaces.dart:62:10 -
          non_constant_identifier_names
   info - Name non-constant identifiers using lowerCamelCase - lib\services\interfaces.dart:65:10 -
          non_constant_identifier_names
   info - Name non-constant identifiers using lowerCamelCase - lib\services\interfaces.dart:66:10 -
          non_constant_identifier_names
   info - 'enablePersistence' is deprecated and shouldn't be used - lib\services\products.dart:46:14 -
          deprecated_member_use
   info - Close instances of `dart.core.Sink` - lib\services\resp.dart:8:25 - close_sinks
   info - Close instances of `dart.core.Sink` - lib\services\resp.dart:9:27 - close_sinks
   info - Close instances of `dart.core.Sink` - lib\services\store.dart:12:26 - close_sinks
   info - Close instances of `dart.core.Sink` - lib\services\store.dart:13:31 - close_sinks
   info - Close instances of `dart.core.Sink` - lib\services\store.dart:15:32 - close_sinks
   info - 'enablePersistence' is deprecated and shouldn't be used - lib\services\store.dart:21:14 -
          deprecated_member_use
   info - The value of the '?.' operator can be 'null', which isn't appropriate as an operand of a
          logical operator - lib\services\store.dart:128:28 - null_aware_in_logical_operator
   info - This class (or a class which this class inherits from) is marked as '@immutable', but one or
          more of its instance fields are not final: SearchAppBar.actions - lib\shared\searchBar.dart:5:7
          - must_be_immutable

37 issues found. (ran in 66.5s)

flutter doctor -v`

[√] Flutter (Channel master, v1.10.15-pre.39, on Microsoft Windows [Version 10.0.17763.504], locale
    en-US)
    • Flutter version 1.10.15-pre.39 at C:\flutter
    • Framework revision 2adda80c10 (5 days ago), 2019-10-09 16:58:41 -0700
    • Engine revision e693192167
    • Dart version 2.6.0 (build 2.6.0-dev.6.0 41d13f0ffe)


[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at C:\Android\android-sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • ANDROID_HOME = C:\Android\android-sdk
    • ANDROID_SDK_ROOT = C:\Android\android-sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
    • All Android licenses accepted.

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.1.2)
    • Visual Studio at E:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.1.29001.49

[√] Android Studio (version 3.4)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 38.1.1
    • Dart plugin version 183.6270
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[√] IntelliJ IDEA Community Edition (version 2019.2)
    • IntelliJ at E:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.2.3
    • Flutter plugin version 40.0.4
    • Dart plugin version 192.6817.14

[√] VS Code (version 1.39.1)
    • VS Code at C:\Users\snake\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.5.1

[√] Connected device (2 available)
    • SM G355H • 4203e926b406c100 • android-arm • Android 4.4.2 (API 19)
    • Windows  • Windows          • windows-x64 • Microsoft Windows [Version 10.0.17763.504]

• No issues found!

2 个答案:

答案 0 :(得分:1)

您可以在--profile模式下运行您的应用,并获得--release的性能,并在--debug模式下获得日志。

然后您可以找到未捕获的异常。

如果需要更多帮助以发现问题,请提供日志。

:心动

答案 1 :(得分:0)

您应尝试使用 flutter run --release 安装该应用。 这样,您将看到应用程序在崩溃期间引发什么样的错误。

此外,如果您尚未检查页面,则可以找到更多信息here