Flutter Application release apk 在真实设备上无法正常工作

Posted

技术标签:

【中文标题】Flutter Application release apk 在真实设备上无法正常工作【英文标题】:Flutter Application release apk not working properly on Real Device 【发布时间】:2022-01-20 23:33:05 【问题描述】:

我正在尝试为我的 Flutter 应用程序构建一个发布 apk,我的应用程序是一个简单的计时器,它运行 50 分钟然后自行重置,在整个构建应用程序的过程中,我在模拟器上运行它并且它正在运行完美,但现在我想在真实设备上运行该应用程序。我使用flutter build apk --release 构建应用程序,并将应用程序安装在我的设备(Samsung Galaxy A52)上。

应用的外观:

应用在我在真实设备上运行的发布 apk 版本上的外观:

从昨天开始,我一直在努力解决这个问题,我尝试了很多选项,但找不到任何解决我问题的方法,我什至尝试创建一个新项目并再次编写代码,但我得到了结果相同,我不知道这个错误是关于什么的,所以我提供了我认为相关的所有信息。

可以在此处找到此应用程序的代码:https://github.com/samitkapoor/sitsmart.git

这是flutter run --verbose

   [  +64 ms] executing: [C:\src\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[  +82 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] 83dfb2237a22ad92c38e345b3aa85aeecae732aa
[   +1 ms] executing: [C:\src\flutter/] git tag --points-at 83dfb2237a22ad92c38e345b3aa85aeecae732aa
[ +144 ms] Exit code 0 from: git tag --points-at 83dfb2237a22ad92c38e345b3aa85aeecae732aa
[   +3 ms] executing: [C:\src\flutter/] git describe --match *.*.* --long --tags 83dfb2237a22ad92c38e345b3aa85aeecae732aa
[ +115 ms] Exit code 0 from: git describe --match *.*.* --long --tags 83dfb2237a22ad92c38e345b3aa85aeecae732aa
[        ] 2.6.0-5.0.pre-147-g83dfb2237a
[   +9 ms] executing: [C:\src\flutter/] git rev-parse --abbrev-ref --symbolic @u
[  +33 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @u
[        ] origin/master
[        ] executing: [C:\src\flutter/] git ls-remote --get-url origin
[  +28 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[ +102 ms] executing: [C:\src\flutter/] git rev-parse --abbrev-ref HEAD
[  +35 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] master
[  +86 ms] Artifact Instance of 'androidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'iosEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +5 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +64 ms] executing: C:\Users\Samit\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l
[  +54 ms] List of devices attached
           192.168.0.149:5555     device product:a52qnsxx model:SM_A525F device:a52q transport_id:5
[   +7 ms] C:\Users\Samit\AppData\Local\Android\sdk\platform-tools\adb.exe -s 192.168.0.149:5555 shell getprop
[ +121 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +85 ms] Skipping pub get: version match.
[ +131 ms] Generating D:\Visual Studio Code\Flutter\sitsmart\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java
[  +59 ms] ro.hardware = qcom
[  +63 ms] Initializing file store
[  +13 ms] Skipping target: gen_localizations
[   +8 ms] Skipping target: gen_dart_plugin_registrant
[   +2 ms] Skipping target: _composite
[   +4 ms] complete
[   +7 ms] Launching lib\main.dart on SM A525F in debug mode...
[   +8 ms] C:\src\flutter\bin\cache\dart-sdk\bin\dart.exe --disable-dart-dev C:\src\flutter\bin\cache\artifacts\engine\windows-x64\frontend_server.dart.snapshot
--sdk-root C:\src\flutter\bin\cache\artifacts\engine\common\flutter_patched_sdk/ --incremental --target=flutter --debugger-module-names
--experimental-emit-debug-metadata -DFLUTTER_WEB_AUTO_DETECT=true --output-dill
C:\Users\Samit\AppData\Local\Temp\flutter_tools.3dace968\flutter_tool.564dbf46\app.dill --packages D:\Visual Studio
Code\Flutter\sitsmart\.dart_tool\package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation --filesystem-scheme    
org-dartlang-root --initialize-from-dill build\c075001b96339384a97db4862b8ab8db.cache.dill.track.dill --flutter-widget-cache
--enable-experiment=alternative-invalidation-strategy
[  +17 ms] executing: C:\Users\Samit\AppData\Local\Android\sdk\build-tools\31.0.0\aapt dump xmltree D:\Visual Studio
Code\Flutter\sitsmart\build\app\outputs\flutter-apk\app.apk AndroidManifest.xml
[  +23 ms] Exit code 0 from: C:\Users\Samit\AppData\Local\Android\sdk\build-tools\31.0.0\aapt dump xmltree D:\Visual Studio
Code\Flutter\sitsmart\build\app\outputs\flutter-apk\app.apk AndroidManifest.xml
[   +1 ms] N: android=http://schemas.android.com/apk/res/android
             E: manifest (line=2)
               A: android:versionCode(0x0101021b)=(type 0x10)0x1
               A: android:versionName(0x0101021c)="1.0.0" (Raw: "1.0.0")
               A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1e
               A: android:compileSdkVersionCodename(0x01010573)="11" (Raw: "11")
               A: package="com.example.sitsmart" (Raw: "com.example.sitsmart")
               A: platformBuildVersionCode=(type 0x10)0x1e
               A: platformBuildVersionName=(type 0x10)0xb
               E: uses-sdk (line=7)
                 A: android:minSdkVersion(0x0101020c)=(type 0x10)0x13
                 A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1e
               E: uses-permission (line=14)
                 A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
               E: application (line=16)
                 A: android:label(0x01010001)="sitsmart" (Raw: "sitsmart")
                 A: android:icon(0x01010002)=@0x7f080000
                 A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
                 A: android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory")
                 E: activity (line=21)
                   A: android:theme(0x01010000)=@0x7f0a0000
[   +7 ms] Using gradle from D:\Visual Studio Code\Flutter\sitsmart\android\gradlew.bat.
[   +6 ms] executing: C:\Program Files\Android\Android Studio\jre\bin\java -version
[ +138 ms] Exit code 0 from: C:\Program Files\Android\Android Studio\jre\bin\java -version
[   +1 ms] openjdk version "11.0.10" 2021-01-19
           OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
           OpenJDK 64-Bit Server VM (build 11.0.10+0-b96-7249189, mixed mode)
[   +2 ms] executing: [D:\Visual Studio Code\Flutter\sitsmart\android/] D:\Visual Studio Code\Flutter\sitsmart\android\gradlew.bat -Pverbose=true
-Ptarget-platform=android-arm64 -Ptarget=D:\Visual Studio Code\Flutter\sitsmart\lib\main.dart -Pdart-defines=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==
-Pdart-obfuscation=false -Ptrack-widget-creation=true -Ptree-shake-icons=false -Pfilesystem-scheme=org-dartlang-root assembleDebug
[+4569 ms] > Task :app:compileFlutterBuildDebug
[   +1 ms] [  +66 ms] executing: [C:\src\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] [  +64 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] [        ] 83dfb2237a22ad92c38e345b3aa85aeecae732aa
[        ] [        ] executing: [C:\src\flutter/] git tag --points-at 83dfb2237a22ad92c38e345b3aa85aeecae732aa
[        ] [  +43 ms] Exit code 0 from: git tag --points-at 83dfb2237a22ad92c38e345b3aa85aeecae732aa
[        ] [   +1 ms] executing: [C:\src\flutter/] git describe --match *.*.* --long --tags 83dfb2237a22ad92c38e345b3aa85aeecae732aa
[        ] [  +66 ms] Exit code 0 from: git describe --match *.*.* --long --tags 83dfb2237a22ad92c38e345b3aa85aeecae732aa
[        ] [        ] 2.6.0-5.0.pre-147-g83dfb2237a
[        ] [   +7 ms] executing: [C:\src\flutter/] git rev-parse --abbrev-ref --symbolic @u
[        ] [  +30 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @u
[        ] [        ] origin/master
[        ] [        ] executing: [C:\src\flutter/] git ls-remote --get-url origin
[        ] [  +26 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] [        ] https://github.com/flutter/flutter.git
[        ] [  +54 ms] executing: [C:\src\flutter/] git rev-parse --abbrev-ref HEAD
[        ] [  +30 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] [        ] master
[        ] [  +54 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] [   +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[   +1 ms] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[   +1 ms] [ +102 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ] [   +3 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[   +1 ms] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +1 ms] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[   +1 ms] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[   +6 ms] [        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[   +2 ms] [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[   +2 ms] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[   +1 ms] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[   +1 ms] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[   +2 ms] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[   +1 ms] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[        ] [  +42 ms] Initializing file store
[   +1 ms] [  +17 ms] Done initializing file store
[   +1 ms] [  +50 ms] Skipping target: gen_localizations
[        ] [  +15 ms] Skipping target: gen_dart_plugin_registrant
[        ] [ +632 ms] kernel_snapshot: Starting due to InvalidatedReasonKind.inputChanged: The following inputs have updated contents: D:\Visual Studio
Code\Flutter\sitsmart\lib\main.dart,D:\Visual Studio Code\Flutter\sitsmart\lib\core\infoscreen.dart,D:\Visual Studio
Code\Flutter\sitsmart\lib\core\homescreen.dart,D:\Visual Studio Code\Flutter\sitsmart\lib\components\animatedsliverappbar.dart,D:\Visual Studio
Code\Flutter\sitsmart\lib\components\animatedsitsmartappbar.dart,D:\Visual Studio Code\Flutter\sitsmart\lib\components\timer.dart,D:\Visual Studio
Code\Flutter\sitsmart\lib\models\timermodel.dart
[   +3 ms] [  +13 ms] C:\src\flutter\bin\cache\dart-sdk\bin\dart.exe --disable-dart-dev
C:\src\flutter\bin\cache\artifacts\engine\windows-x64\frontend_server.dart.snapshot --sdk-root C:\src\flutter\bin\cache\artifacts\engine\common\flutter_patched_sdk/ 
--target=flutter --no-print-incremental-dependencies -DFLUTTER_WEB_AUTO_DETECT=true -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts
--track-widget-creation --no-link-platform --packages D:\Visual Studio Code\Flutter\sitsmart\.dart_tool\package_config.json --output-dill D:\Visual Studio
Code\Flutter\sitsmart\.dart_tool\flutter_build\9cd237c5927dd399a4835e253c6b841b\app.dill --depfile D:\Visual Studio
Code\Flutter\sitsmart\.dart_tool\flutter_build\9cd237c5927dd399a4835e253c6b841b\kernel_snapshot.d package:sitsmart/main.dart
[+10331 ms] [+10484 ms] kernel_snapshot: Complete
[ +299 ms] [ +238 ms] invalidated build due to missing files: D:\Visual Studio Code\Flutter\sitsmart\DOES_NOT_EXIST_RERUN_FOR_WILDCARD445610250
[ +288 ms] [ +374 ms] debug_android_application: Starting due to InvalidatedReasonKind.inputChanged: The following inputs have updated contents: D:\Visual Studio
Code\Flutter\sitsmart\.dart_tool\flutter_build\9cd237c5927dd399a4835e253c6b841b\app.dill,D:\Visual Studio Code\Flutter\sitsmart\pubspec.yaml,D:\Visual Studio        
Code\Flutter\sitsmart\build\app\intermediates\flutter\debug\flutter_assets\kernel_blob.bin,D:\Visual Studio
Code\Flutter\sitsmart\build\app\intermediates\flutter\debug\flutter_assets\FontManifest.json, InvalidatedReasonKind.inputMissing: The following inputs were missing: 
D:\Visual Studio Code\Flutter\sitsmart\DOES_NOT_EXIST_RERUN_FOR_WILDCARD445610250
[ +298 ms] [ +234 ms] Manifest contained wildcard assets. Inserting missing file into build graph to force rerun. for more information see #56466.
[ +111 ms] [  +71 ms] debug_android_application: Complete
[ +299 ms] [ +319 ms] Persisting file store
[   +1 ms] [  +13 ms] Done persisting file store
[   +1 ms] [  +11 ms] build succeeded.
[        ] [  +14 ms] "flutter assemble" took 12,659ms.
[ +198 ms] [ +171 ms] ensureAnalyticsSent: 166ms
[   +1 ms] [   +1 ms] Running shutdown hooks
[        ] [        ] Shutdown hooks complete
[        ] [        ] exiting with code 0
[        ] Parameter format not correct -
[ +187 ms] > Task :app:packLibsflutterBuildDebug UP-TO-DATE
[   +1 ms] > Task :app:preBuild UP-TO-DATE
[   +1 ms] > Task :app:preDebugBuild UP-TO-DATE
[   +1 ms] > Task :app:compileDebugAidl NO-SOURCE
[   +1 ms] > Task :app:compileDebugRenderscript NO-SOURCE
[   +1 ms] > Task :app:generateDebugBuildConfig UP-TO-DATE
[        ] > Task :app:checkDebugAarMetadata UP-TO-DATE
[ +103 ms] > Task :app:cleanMergeDebugAssets
[  +21 ms] > Task :app:mergeDebugShaders UP-TO-DATE
[   +6 ms] > Task :app:compileDebugShaders NO-SOURCE
[        ] > Task :app:generateDebugAssets UP-TO-DATE
[   +1 ms] > Task :app:mergeDebugAssets
[ +271 ms] > Task :app:copyFlutterAssetsDebug
[   +1 ms] > Task :app:generateDebugResValues UP-TO-DATE
[        ] > Task :app:generateDebugResources UP-TO-DATE
[   +1 ms] > Task :app:mergeDebugResources UP-TO-DATE
[   +2 ms] > Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
[        ] > Task :app:extractDeepLinksDebug UP-TO-DATE
[   +2 ms] > Task :app:processDebugMainManifest UP-TO-DATE
[        ] > Task :app:processDebugManifest UP-TO-DATE
[  +88 ms] > Task :app:processDebugManifestForPackage UP-TO-DATE
[   +1 ms] > Task :app:processDebugResources UP-TO-DATE
[+1490 ms] > Task :app:compileDebugKotlin
[   +5 ms] > Task :app:javaPreCompileDebug UP-TO-DATE
[ +102 ms] > Task :app:compileDebugJavaWithJavac UP-TO-DATE
[   +1 ms] > Task :app:compileDebugSources UP-TO-DATE
[   +1 ms] > Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
[   +1 ms] > Task :app:compressDebugAssets UP-TO-DATE
[   +1 ms] > Task :app:processDebugJavaRes NO-SOURCE
[  +92 ms] > Task :app:checkDebugDuplicateClasses
[ +494 ms] > Task :app:mergeDebugJavaResource
[ +498 ms] > Task :app:dexBuilderDebug
[   +1 ms] > Task :app:mergeDebugJniLibFolders UP-TO-DATE
[        ] > Task :app:validateSigningDebug UP-TO-DATE
[        ] > Task :app:desugarDebugFileDependencies
[        ] > Task :app:mergeExtDexDebug UP-TO-DATE
[        ] > Task :app:mergeDexDebug UP-TO-DATE
[ +503 ms] > Task :app:mergeDebugNativeLibs
[  +92 ms] > Task :app:stripDebugDebugSymbols
[   +2 ms] Unable to strip the following libraries, packaging them as they are: libflutter.so.
[+1898 ms] > Task :app:packageDebug
[  +94 ms] > Task :app:assembleDebug
[        ] Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
[        ] Use '--warning-mode all' to show the individual deprecation warnings.
[        ] See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
[  +24 ms] BUILD SUCCESSFUL in 22s
[   +1 ms] 32 actionable tasks: 13 executed, 19 up-to-date
[ +528 ms] Running Gradle task 'assembleDebug'... (completed in 23.1s)
[ +102 ms] calculateSha: LocalDirectory: 'D:\Visual Studio Code\Flutter\sitsmart\build\app\outputs\flutter-apk'/app.apk
[ +841 ms] √  Built build\app\outputs\flutter-apk\app-debug.apk.
[   +7 ms] executing: C:\Users\Samit\AppData\Local\Android\sdk\build-tools\31.0.0\aapt dump xmltree D:\Visual Studio
Code\Flutter\sitsmart\build\app\outputs\flutter-apk\app.apk AndroidManifest.xml
[  +25 ms] Exit code 0 from: C:\Users\Samit\AppData\Local\Android\sdk\build-tools\31.0.0\aapt dump xmltree D:\Visual Studio
Code\Flutter\sitsmart\build\app\outputs\flutter-apk\app.apk AndroidManifest.xml
[   +1 ms] N: android=http://schemas.android.com/apk/res/android
             E: manifest (line=2)
               A: android:versionCode(0x0101021b)=(type 0x10)0x1
               A: android:versionName(0x0101021c)="1.0.0" (Raw: "1.0.0")
               A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1e
               A: android:compileSdkVersionCodename(0x01010573)="11" (Raw: "11")
               A: package="com.example.sitsmart" (Raw: "com.example.sitsmart")
               A: platformBuildVersionCode=(type 0x10)0x1e
               A: platformBuildVersionName=(type 0x10)0xb
               E: uses-sdk (line=7)
                 A: android:minSdkVersion(0x0101020c)=(type 0x10)0x13
                 A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1e
               E: uses-permission (line=14)
                 A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
               E: application (line=16)
                 A: android:label(0x01010001)="sitsmart" (Raw: "sitsmart")
                 A: android:icon(0x01010002)=@0x7f080000
                 A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
                 A: android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory")
                 E: activity (line=21)
                   A: android:theme(0x01010000)=@0x7f0a0000
                   A: android:name(0x01010003)="com.example.sitsmart.MainActivity" (Raw: "com.example.sitsmart.MainActivity")
                   A: android:launchMode(0x0101001d)=(type 0x10)0x1
                   A: android:configChanges(0x0101001f)=(type 0x11)0x40003fb4
                   A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x10
                   A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff
                   E: meta-data (line=35)
                     A: android:name(0x01010003)="io.flutter.embedding.android.NormalTheme" (Raw: "io.flutter.embedding.android.NormalTheme")
                     A: android:resource(0x01010025)=@0x7f0a0001
                   E: intent-filter (line=39)
                     E: action (line=40)
                       A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
                     E: category (line=42)
                       A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
                 E: meta-data (line=49)
                   A: android:name(0x01010003)="flutterEmbedding" (Raw: "flutterEmbedding")
                   A: android:value(0x01010024)=(type 0x10)0x2
[   +7 ms] Stopping app 'app.apk' on SM A525F.
[   +1 ms] executing: C:\Users\Samit\AppData\Local\Android\sdk\platform-tools\adb.exe -s 192.168.0.149:5555 shell am force-stop com.example.sitsmart
[ +189 ms] executing: C:\Users\Samit\AppData\Local\Android\sdk\platform-tools\adb.exe -s 192.168.0.149:5555 shell pm list packages com.example.sitsmart
[ +133 ms] package:com.example.sitsmart
[   +2 ms] executing: C:\Users\Samit\AppData\Local\Android\sdk\platform-tools\adb.exe -s 192.168.0.149:5555 shell cat /data/local/tmp/sky.com.example.sitsmart.sha1
[  +65 ms] aec9bcb234b8e22d206a1ccc8cb9f5a0d3818635
[   +1 ms] Installing APK.
[   +2 ms] Installing build\app\outputs\flutter-apk\app.apk...
[        ] executing: C:\Users\Samit\AppData\Local\Android\sdk\platform-tools\adb.exe -s 192.168.0.149:5555 install -t -r D:\Visual Studio
Code\Flutter\sitsmart\build\app\outputs\flutter-apk\app.apk
[+10095 ms] Performing Streamed Install
                     Success
[   +1 ms] Installing build\app\outputs\flutter-apk\app.apk... (completed in 10.1s)
[   +3 ms] executing: C:\Users\Samit\AppData\Local\Android\sdk\platform-tools\adb.exe -s 192.168.0.149:5555 shell echo -n 19ddecfadb76c2d3fcaea26888a684df43f742cf > 
/data/local/tmp/sky.com.example.sitsmart.sha1
[  +68 ms] executing: C:\Users\Samit\AppData\Local\Android\sdk\platform-tools\adb.exe -s 192.168.0.149:5555 shell -x logcat -v time -t 1
[+1136 ms] --------- beginning of main
                    12-18 17:42:05.187 I/Finsky  (23282): [84430] etc.a(5): AIM: AppInfoManager-Perf > OnDeviceAppInfo > cacheHitCount=0, cacheMissCount=1. Missed   
                    in cache (limit 10) : [com.example.sitsmart]
[  +11 ms] executing: C:\Users\Samit\AppData\Local\Android\sdk\platform-tools\adb.exe -s 192.168.0.149:5555 shell am start -a android.intent.action.RUN -f 0x20000000
--ez enable-background-compilation true --ez enable-dart-profiling true --ez enable-checked-mode true --ez verify-entry-points true
com.example.sitsmart/com.example.sitsmart.MainActivity
[ +208 ms] Starting: Intent  act=android.intent.action.RUN flg=0x20000000 cmp=com.example.sitsmart/.MainActivity (has extras) 
[   +3 ms] Waiting for observatory port to be available...
[+2013 ms] Observatory URL on device: http://127.0.0.1:40129/T6ugFyrht1k=/
[   +1 ms] executing: C:\Users\Samit\AppData\Local\Android\sdk\platform-tools\adb.exe -s 192.168.0.149:5555 forward tcp:0 tcp:40129
[  +19 ms] 65377
[        ] Forwarded host port 65377 to device port 40129 for Observatory
[  +33 ms] Caching compiled dill
[  +36 ms] Connecting to service protocol: http://127.0.0.1:65377/T6ugFyrht1k=/
[ +259 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at http://127.0.0.1:65377/T6ugFyrht1k=/.
[ +272 ms] DDS is listening at http://127.0.0.1:65380/zVxOgPHx1z4=/.
[  +71 ms] Successfully connected to service protocol: http://127.0.0.1:65377/T6ugFyrht1k=/
[ +103 ms] DevFS: Creating new filesystem on the device (null)
[  +39 ms] DevFS: Created new filesystem on the device (file:///data/user/0/com.example.sitsmart/code_cache/sitsmartPBNFMK/sitsmart/)
[   +2 ms] Updating assets
[  +95 ms] Manifest contained wildcard assets. Inserting missing file into build graph to force rerun. for more information see #56466.
[   +5 ms] Syncing files to device SM A525F...
[   +1 ms] <- reset
[        ] Compiling dart to kernel with 0 updated files
[   +4 ms] <- recompile package:sitsmart/main.dart f5a211e1-4941-4330-a79a-75d1fa8c87db
[        ] <- f5a211e1-4941-4330-a79a-75d1fa8c87db
[  +92 ms] Updating files.
[   +1 ms] DevFS: Sync finished
[   +8 ms] Syncing files to device SM A525F... (completed in 107ms)
[   +1 ms] Synced 0.0MB.
[   +5 ms] <- accept
[  +29 ms] Connected to _flutterView/0xb400007020da3dc0.
[   +3 ms] Flutter run key commands.
[   +2 ms] r Hot reload. 
[   +2 ms] R Hot restart.
[   +1 ms] h List all available interactive commands.
[   +2 ms] d Detach (terminate "flutter run" but leave application running).
[   +1 ms] c Clear the screen
[   +3 ms] q Quit (terminate the application on the device).
[   +3 ms]  Running with sound null safety 
[   +5 ms] An Observatory debugger and profiler on SM A525F is available at: http://127.0.0.1:65380/zVxOgPHx1z4=/
[ +560 ms] DevTools activation throttled until 2021-12-19 04:20:57.706826.
[ +344 ms] I/SurfaceView(31702): applySurfaceTransforms: t = android.view.SurfaceControl$Transaction@cf6b3c5 surfaceControl = Surface(name=SurfaceView -
com.example.sitsmart/com.example.sitsmart.MainActivity@30da42f@0)/@0xf2ec11a frame = 1
[  +82 ms] I/ViewRootImpl@b252009[MainActivity](31702): MSG_WINDOW_FOCUS_CHANGED 1 1
[   +3 ms] D/InputMethodManager(31702): prepareNavigationBarInfo() DecorView@bd2900d[MainActivity]
[   +1 ms] D/InputMethodManager(31702): getNavigationBarColor() -16711423
[   +2 ms] D/InputMethodManager(31702): prepareNavigationBarInfo() DecorView@bd2900d[MainActivity]
[   +1 ms] D/InputMethodManager(31702): getNavigationBarColor() -16711423
[        ] V/InputMethodManager(31702): Starting input: tba=com.example.sitsmart ic=null mNaviBarColor -16711423 mIsGetNaviBarColorSuccess true , NavVisible : true ,
NavTrans : false
[   +1 ms] D/InputMethodManager(31702): startInputInner - Id : 0
[        ] I/InputMethodManager(31702): startInputInner - mService.startInputOrWindowGainedFocus
[   +9 ms] D/InputTransport(31702): Input channel constructed: 'ClientS', fd=105
[   +1 ms] D/InputMethodManager(31702): prepareNavigationBarInfo() DecorView@bd2900d[MainActivity]
[   +1 ms] D/InputMethodManager(31702): getNavigationBarColor() -16711423
[   +1 ms] V/InputMethodManager(31702): Starting input: tba=com.example.sitsmart ic=null mNaviBarColor -16711423 mIsGetNaviBarColorSuccess true , NavVisible : true ,
NavTrans : false
[   +1 ms] D/InputMethodManager(31702): startInputInner - Id : 0
[  +45 ms] I/SurfaceControl(31702): nativeRelease nativeObject s[-5476376668247707056]
[        ] I/SurfaceControl(31702): nativeRelease nativeObject e[-5476376668247707056]
[        ] I/SurfaceControl(31702): nativeRelease nativeObject s[-5476376668247708640]
[        ] I/SurfaceControl(31702): nativeRelease nativeObject e[-5476376668247708640]
[ +295 ms] The Flutter DevTools debugger and profiler on SM A525F is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:65380/zVxOgPHx1z4=/


这是flutter doctor -v

非常感谢任何形式的帮助!

【问题讨论】:

【参考方案1】:

从我的系统中完全删除 Flutter 和 Android Studio,然后重新下载是适合我的解决方案!

【讨论】:

【参考方案2】:

应该修复,检查我留给你的 TODO 笔记(在修复分支中)

问题在于 AnimatedBuilder 的控制器转换(文件:animated_sitsmart_appbar.dart)

向您的仓库提出拉取请求,分支名称:修复。

链接:https://github.com/GitGud31/sitsmart/tree/fix

【讨论】:

应用在真机上有时还是加载失败,我尝试打开应用几次,应用成功加载的次数小于应用失败的次数并显示白屏,如问题所示。但是,是的,您的更改确实有点帮助,感谢您清理代码,但应用程序仍然无法按预期工作。 我在我的真实设备上尽可能多地尝试(我手上没有太多时间),并且每次都有效。我正在运行最新版本的颤振 2.8.1。是的,还有其他错误和改进。祝你好运!

以上是关于Flutter Application release apk 在真实设备上无法正常工作的主要内容,如果未能解决你的问题,请参考以下文章

Flutter-flutter run报错Could not build the application for the simulator.

Http.post不接受flutter / dart中的内容类型application / query + json

如何通过 Dart/Flutter 中的“application/octet-stream”将 png 文件发送到 Microsoft Custom Vision?

Flutter Application release apk 在真实设备上无法正常工作

Flutter Application Bloc 侦听器未接收到状态更新

flutter Could not find the built application bundle