SDK 更新后 Flutter 无法运行
Posted
技术标签:
【中文标题】SDK 更新后 Flutter 无法运行【英文标题】:Flutter wont run after SDK update 【发布时间】:2021-03-07 08:33:07 【问题描述】:在我更新了我的颤振 sdk 并不得不运行 pub get 之后,我最近需要从 github 克隆一个项目,它表明我需要根据这个链接 (https://flutter.dev/go/android-project-migration) 中的说明进行迁移,我已经设法做到了, 问题变成了当我运行颤振时,我得到以下错误
FAILURE: Build failed with an exception.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
C:\Users\HP\AndroidStudioProjects\Clima-Flutter\android\app\src\main\AndroidManifest.xml:25:13-28:19: AAPT: error: resource style/NormalTheme (aka co.appbrewery.clima:style/NormalTheme) not found.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 13s
Exception: Gradle task assembleDebug failed with exit code 1
当我使用颤振详细时,我得到了这些
C:\Users\HP\AndroidStudioProjects\Clima-Flutter>flutter run --verbose
[ +130 ms] executing: [C:\src\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +62 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ ] f30b7f4db93ee747cd727df747941a28ead25ff5
[ ] executing: [C:\src\flutter/] git tag --points-at HEAD
[ +52 ms] Exit code 0 from: git tag --points-at HEAD
[ ] 1.22.0-12.4.pre
1.22.1
[ +10 ms] executing: [C:\src\flutter/] git rev-parse --abbrev-ref --symbolic @u
[ +47 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @u
[ ] origin/stable
[ ] executing: [C:\src\flutter/] git ls-remote --get-url origin
[ +44 ms] Exit code 0 from: git ls-remote --get-url origin
[ ] https://github.com/flutter/flutter.git
[ +93 ms] executing: [C:\src\flutter/] git rev-parse --abbrev-ref HEAD
[ +50 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ ] stable
[ +101 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ +11 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.
[ +7 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ +7 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ +5 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ +3 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ +3 ms] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ +33 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +38 ms] executing: C:\Users\HP\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l
[ +80 ms] List of devices attached
043911194R100252 device product:H624 model:Infinix_X627 device:Infinix-X627STU transport_id:1
[ +11 ms] C:\Users\HP\AppData\Local\Android\sdk\platform-tools\adb.exe -s 043911194R100252 shell getprop
[ +164 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[ +5 ms] 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 'MacOSEngineArtifacts' is not required, skipping update.
[ +1 ms] 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.
[ +370 ms] Generating C:\Users\HP\AndroidStudioProjects\Clima-Flutter\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java
[ +30 ms] ro.hardware = mt6761
[ +1 ms] ro.build.characteristics = default
[ +54 ms] Starting incremental build...
[ +3 ms] Initializing file store
[ +12 ms] Skipping target: gen_localizations
[ +8 ms] complete
[ +7 ms] Launching lib\main.dart on Infinix X627 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
-Ddart.developer.causal_async_stacks=true --output-dill C:\Users\HP\AppData\Local\Temp\flutter_tools.7acea879\flutter_tool.7d1d5a82\app.dill --packages .packages
-Ddart.vm.profile=false -Ddart.vm.product=false
--bytecode-options=source-positions,local-var-info,debugger-stops,instance-field-initializers,keep-unreachable-code,avoid-closure-call-instructions --enable-asserts
--track-widget-creation --filesystem-scheme org-dartlang-root --initialize-from-dill build\cache.dill.track.dill
[ +28 ms] executing: C:\Users\HP\AppData\Local\Android\sdk\platform-tools\adb.exe -s 043911194R100252 shell -x logcat -v time -t 1
[ +98 ms] Exit code 0 from: C:\Users\HP\AppData\Local\Android\sdk\platform-tools\adb.exe -s 043911194R100252 shell -x logcat -v time -t 1
[ ] --------- beginning of main
11-24 15:22:59.002 I/SurfaceFlinger( 412): [Built-in Screen (type:0)] fps:3.953414,dur:1011.78,max:629.23,min:16.35
[ +1 ms] executing: C:\Users\HP\AppData\Local\Android\sdk\platform-tools\adb.exe -s 043911194R100252 shell -x logcat -v time -t 1
[ +97 ms] Exit code 0 from: C:\Users\HP\AppData\Local\Android\sdk\platform-tools\adb.exe -s 043911194R100252 shell -x logcat -v time -t 1
[ ] --------- beginning of main
11-24 15:22:59.378 I/ADB_SERVICES( 1616): post waitpid (pid=17140) status=0000
[ +21 ms] <- compile package:clima/main.dart
[ +32 ms] executing: C:\Users\HP\AppData\Local\Android\sdk\platform-tools\adb.exe version
[ +156 ms] Android Debug Bridge version 1.0.41
Version 30.0.4-6686687
Installed as C:\Users\HP\AppData\Local\Android\sdk\platform-tools\adb.exe
[ +6 ms] executing: C:\Users\HP\AppData\Local\Android\sdk\platform-tools\adb.exe start-server
[ +158 ms] Building APK
[ +46 ms] Running Gradle task 'assembleDebug'...
[ +91 ms] gradle.properties already sets `android.enableR8`
[ +15 ms] Using gradle from C:\Users\HP\AndroidStudioProjects\Clima-Flutter\android\gradlew.bat.
[ +3 ms] C:\Users\HP\AndroidStudioProjects\Clima-Flutter\android\gradlew.bat mode: 33279 rwxrwxrwx.
[ +16 ms] executing: C:\Program Files\Android\Android Studio\jre\bin\java -version
[ +208 ms] Exit code 0 from: C:\Program Files\Android\Android Studio\jre\bin\java -version
[ ] openjdk version "1.8.0_242-release"
OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
OpenJDK 64-Bit Server VM (build 25.242-b01, mixed mode)
[ +4 ms] executing: [C:\Users\HP\AndroidStudioProjects\Clima-Flutter\android/] C:\Users\HP\AndroidStudioProjects\Clima-Flutter\android\gradlew.bat -Pverbose=true
-Ptarget-platform=android-arm -Ptarget=C:\Users\HP\AndroidStudioProjects\Clima-Flutter\lib\main.dart -Ptrack-widget-creation=true -Pfilesystem-scheme=org-dartlang-root assembleDebug
[+1032 ms] Welcome to Gradle 5.4.1!
[ +1 ms] Here are the highlights of this release:
[ +1 ms] - Run builds with JDK12
[ +1 ms] - New API for Incremental Tasks
[ ] - Updates to native projects, including Swift 5 support
[ +1 ms] For more details see https://docs.gradle.org/5.4.1/release-notes.html
[+4112 ms] > Task :app:compileFlutterBuildDebug
[ +91 ms] [ +180 ms] executing: [C:\src\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +42 ms] [ +91 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +87 ms] [ ] f30b7f4db93ee747cd727df747941a28ead25ff5
[ +22 ms] [ +5 ms] executing: [C:\src\flutter/] git tag --points-at HEAD
[ +3 ms] [ +58 ms] Exit code 0 from: git tag --points-at HEAD
[ +1 ms] [ ] 1.22.0-12.4.pre
[ +2 ms] 1.22.1
[ +1 ms] [ +15 ms] executing: [C:\src\flutter/] git rev-parse --abbrev-ref --symbolic @u
[ +2 ms] [ +58 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
[ +1 ms] [ +47 ms] Exit code 0 from: git ls-remote --get-url origin
[ +1 ms] [ ] https://github.com/flutter/flutter.git
[ +107 ms] [ +114 ms] executing: [C:\src\flutter/] git rev-parse --abbrev-ref HEAD
[ +3 ms] [ +167 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ +2 ms] [ ] stable
[ +1 ms] [ +85 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.
[ ] [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] [ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +9 ms] [ +6 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.
[ ] [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ +1 ms] [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +4 ms] [ +27 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[ +1 ms] [ ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[ ] [ ] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[ +2 ms] [ ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ +6 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.
[ +33 ms] [ ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ +16 ms] [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ ] [ +1 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ +1 ms] [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ +6 ms] [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ +46 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.
[ +17 ms] [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ +5 ms] [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ +13 ms] [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ +1 ms] [ ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[ +1 ms] [ +155 ms] Initializing file store
[ +1 ms] [ +39 ms] Done initializing file store
[ +79 ms] [ +82 ms] Skipping target: gen_localizations
[+1099 ms] [+1139 ms] Skipping target: kernel_snapshot
[ +1 ms] [ +12 ms] invalidated build due to missing files: C:\Users\HP\AndroidStudioProjects\Clima-Flutter\DOES_NOT_EXIST_RERUN_FOR_WILDCARD208953078
[ +699 ms] [ +691 ms] debug_android_application: Starting due to InvalidatedReason.inputMissing
[ +299 ms] [ +275 ms] Manifest contained wildcard assets. Inserting missing file into build graph to force rerun. for more information see #56466.
[ ] [ +48 ms] debug_android_application: Complete
[ +600 ms] [ +534 ms] Persisting file store
[ +2 ms] [ +18 ms] Done persisting file store
[ +1 ms] [ +8 ms] build succeeded.
[ ] [ +18 ms] "flutter assemble" took 3,103ms.
[ ] [ +5 ms] ensureAnalyticsSent: 0ms
[ ] [ +1 ms] Running shutdown hooks
[ ] [ ] Shutdown hooks complete
[ +1 ms] [ +5 ms] exiting with code 0
[ +399 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
[ +2 ms] > Task :app:checkDebugManifest UP-TO-DATE
[ +2 ms] > Task :app:generateDebugBuildConfig UP-TO-DATE
[ +1 ms] > Task :app:javaPreCompileDebug UP-TO-DATE
[ +2 ms] > Task :app:compileDebugRenderscript NO-SOURCE
[ +79 ms] > Task :app:cleanMergeDebugAssets
[ +1 ms] > Task :app:mergeDebugShaders UP-TO-DATE
[ +1 ms] > Task :app:compileDebugShaders UP-TO-DATE
[ +1 ms] > Task :app:generateDebugAssets UP-TO-DATE
[ ] > Task :app:mergeDebugAssets
[ +412 ms] > Task :app:copyFlutterAssetsDebug
[ +12 ms] > Task :app:mainApkListPersistenceDebug UP-TO-DATE
[ +1 ms] > Task :app:generateDebugResValues UP-TO-DATE
[ +1 ms] > Task :app:generateDebugResources UP-TO-DATE
[ +71 ms] > Task :app:mergeDebugResources UP-TO-DATE
[ +12 ms] > Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
[ ] > Task :app:processDebugManifest UP-TO-DATE
[ +489 ms] > Task :app:processDebugResources FAILED
[ +2 ms] FAILURE: Build failed with an exception.
[ +3 ms] * What went wrong:
[ ] Execution failed for task ':app:processDebugResources'.
[ ] > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
[ ] > Android resource linking failed
[ ] C:\Users\HP\AndroidStudioProjects\Clima-Flutter\android\app\src\main\AndroidManifest.xml:25:13-28:19: AAPT: error: resource style/NormalTheme (aka
co.appbrewery.clima:style/NormalTheme) not found.
[ +1 ms] * Try:
[ +1 ms] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[ ] * Get more help at https://help.gradle.org
[ ] BUILD FAILED in 9s
[ ] 16 actionable tasks: 5 executed, 11 up-to-date
[ +653 ms] Running Gradle task 'assembleDebug'... (completed in 10.9s)
[+1536 ms] Exception: Gradle task assembleDebug failed with exit code 1
[ +3 ms] "flutter run" took 14,127ms.
[ +6 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:607:7)
<asynchronous suspension>
#2 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:977:18)
#3 _rootRunUnary (dart:async/zone.dart:1198:47)
#4 _CustomZone.runUnary (dart:async/zone.dart:1100:19)
#5 _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
#6 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
#7 Future._propagateToListeners (dart:async/future_impl.dart:725:32)
#8 Future._completeWithValue (dart:async/future_impl.dart:529:5)
#9 _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
#10 _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
#11 RunCommand.usageValues (package:flutter_tools/src/commands/run.dart)
#12 _rootRunUnary (dart:async/zone.dart:1198:47)
#13 _CustomZone.runUnary (dart:async/zone.dart:1100:19)
#14 _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
#15 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
#16 Future._propagateToListeners (dart:async/future_impl.dart:725:32)
#17 Future._completeWithValue (dart:async/future_impl.dart:529:5)
#18 _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
#19 _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
#20 AndroidDevice.isLocalEmulator (package:flutter_tools/src/android/android_device.dart)
#21 _rootRunUnary (dart:async/zone.dart:1198:47)
#22 _CustomZone.runUnary (dart:async/zone.dart:1100:19)
#23 _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
#24 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
#25 Future._propagateToListeners (dart:async/future_impl.dart:725:32)
#26 Future._completeWithValue (dart:async/future_impl.dart:529:5)
#27 Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
#28 _rootRun (dart:async/zone.dart:1190:13)
#29 _CustomZone.run (dart:async/zone.dart:1093:19)
#30 _CustomZone.runGuarded (dart:async/zone.dart:997:7)
#31 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
#32 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#33 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#34 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#35 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)
考虑到自更新以来所有其他应用程序似乎运行良好,我似乎无法理解它
【问题讨论】:
Angela Yu,Flutter 课程?不过有一个建议,永远不要通过命令行升级 Flutter,总是下载 zip 文件并使用它。因此,我多次破坏我的项目.. @KetanRamteke 有什么解决办法吗?? 【参考方案1】:就我而言,更新 Gradle 是有效的。 https://developer.android.com/studio/releases/gradle-plugin
【讨论】:
以上是关于SDK 更新后 Flutter 无法运行的主要内容,如果未能解决你的问题,请参考以下文章
Flutter RevenueCat SDK 无法在网络上运行