[英]Flutter app apk does not work properly on phone but works well on emulator
Flutter app apk does not work properly on phone but works well on emulator.Clicking the button to add data to the sqflite database does not work or when I change the application language.I've tried all the suggestions I found on the internet but it still doesn't work I don't understand where is the problem.Works great in the emulator but When I install the apk and install it on my phone, it doesn't work. Flutter 应用程序 apk 在手机上无法正常运行,但在模拟器上运行良好。单击按钮将数据添加到 sqflite 数据库不起作用或当我更改应用程序语言时。我已经尝试了我在互联网上找到的所有建议,但它仍然不起作用我不明白问题出在哪里。在模拟器中效果很好但是当我安装 apk 并将其安装在我的手机上时,它不起作用。 Flutter run -v
Flutter 运行-v
> [ +214 ms] executing: [C:\src\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +132 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +1 ms] 9b2d32b605630f28625709ebd9d78ab3016b2bf6
[ +1 ms] executing: [C:\src\flutter/] git tag --points-at HEAD
[ +144 ms] Exit code 0 from: git tag --points-at HEAD
[ ] 1.22.6
[ +17 ms] executing: [C:\src\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +97 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ +1 ms] origin/stable
[ +1 ms] executing: [C:\src\flutter/] git ls-remote --get-url origin
[ +83 ms] Exit code 0 from: git ls-remote --get-url origin
[ +1 ms] https://github.com/flutter/flutter.git
[ +167 ms] executing: [C:\src\flutter/] git rev-parse --abbrev-ref HEAD
[ +137 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ +5 ms] stable
[ +175 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[ +19 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ +2 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.
[ +12 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ +2 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +78 ms] executing: C:\Users\raghi\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l
[ +101 ms] List of devices attached
[ +8 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[ +1 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ +1 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.
[ +1 ms] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[ +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ +2 ms] 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.
[ +1 ms] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ +3 ms] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[ +164 ms] No supported devices connected.
[ +34 ms] "flutter run" took 511ms.
[ +51 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
#1 RunCommand.validateCommand (package:flutter_tools/src/commands/run.dart:353:7)
<asynchronous suspension>
#2 FlutterCommand.verifyThenRunCommand
(package:flutter_tools/src/runner/flutter_command.dart:933:11)
<asynchronous suspension>
#3 FlutterCommand.run.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command.dart:836:33)
<asynchronous suspension>
#4 FlutterCommand.run.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command.dart)
#5 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:29)
#6 _rootRun (dart:async/zone.dart:1190:13)
#7 _CustomZone.run (dart:async/zone.dart:1093:19)
#8 _runZoned (dart:async/zone.dart:1630:10)
#9 runZoned (dart:async/zone.dart:1550:10)
#10 AppContext.run (package:flutter_tools/src/base/context.dart:149:18)
#11 FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:825:20)
#12 CommandRunner.runCommand (package:args/command_runner.dart:197:27)
#13 FlutterCommandRunner.runCommand.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command_runner.dart:335:21)
#14 _rootRunUnary (dart:async/zone.dart:1198:47)
#15 _CustomZone.runUnary (dart:async/zone.dart:1100:19)
#16 _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
#17 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
#18 Future._propagateToListeners (dart:async/future_impl.dart:725:32)
#19 Future._completeWithValue (dart:async/future_impl.dart:529:5)
#20 _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
#21 _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
#22 FlutterVersion.checkFlutterVersionFreshness (package:flutter_tools/src/version.dart)
#23 _rootRunUnary (dart:async/zone.dart:1198:47)
#24 _CustomZone.runUnary (dart:async/zone.dart:1100:19)
#25 _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
#26 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
#27 Future._propagateToListeners (dart:async/future_impl.dart:725:32)
#28 Future._completeWithValue (dart:async/future_impl.dart:529:5)
#29 Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
#30 _rootRun (dart:async/zone.dart:1190:13)
#31 _CustomZone.run (dart:async/zone.dart:1093:19)
#32 _CustomZone.runGuarded (dart:async/zone.dart:997:7)
#33 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
#34 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#35 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#36 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#37 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)
>[ +396 ms] ensureAnalyticsSent: 374ms
>[ +15 ms] Running shutdown hooks
>[ +2 ms] Shutdown hooks complete
>[ +2 ms] exiting with code 1
I'm just getting the above error.I created a new project and got that error even in the flutter demo app So it's not a bug with my code.Please help me, I've been dealing with this for 3 days我刚刚收到上述错误。我创建了一个新项目,即使在 flutter 演示应用程序中也出现了该错误所以这不是我的代码的错误。请帮助我,我已经处理了 3 天
I'm getting this error with Flutter build apk. Flutter build apk 出现此错误。
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:debugRuntimeClasspath'.
> Failed to transform libs.jar to match attributes {artifactType=processed-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform:
But I do not get errors with these codes, but the apk does not work correctly.但是我没有收到这些代码的错误,但是 apk 不能正常工作。
flutter build apk --debug
flutter build apk --profile
flutter build apk --release
I don't understand why the problem is caused, but I took care of it.I created a new project with a different name and I rebuilt the files of my old project one by one and copied the contents.I re-downloaded all packages under dependencies in new versions.And lastly I added the internet permission androidManifest.xml
even if my application is not using internet.我不明白为什么会出现问题,但是我处理了它。我创建了一个不同名称的新项目,并将旧项目的文件一个一个重建并复制了内容。我重新下载了所有包在新版本的依赖项下。最后我添加了互联网权限
androidManifest.xml
,即使我的应用程序没有使用互联网。 <uses-permission android:name="android.permission.INTERNET" />
This issue most likely occurred after updating Flutter.此问题很可能在更新 Flutter 后发生。 Always check after updating Flutter
更新 Flutter 后总是检查
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.