[英]Execution failed for task ':app:mergeDebugResources' & Build errors
[英]Example Hello world flutter app build failed: Execution failed for task ':app:mergeDebugResources'
我最近安裝了flutter
並嘗試運行由flutter
(編輯器VSCode
)創建的example app
,但出現以下錯誤( build
命令也失敗):
flutter run
Launching lib\main.dart on SM J730F in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Multiple task action failures occurred:
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-3.5.0-5435860-windows Daemon #1: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-3.5.0-5435860-windows Daemon #6: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-3.5.0-5435860-windows Daemon #0: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-3.5.0-5435860-windows Daemon #3: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-3.5.0-5435860-windows Daemon #4: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-3.5.0-5435860-windows Daemon #2: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-3.5.0-5435860-windows Daemon #5: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-3.5.0-5435860-windows Daemon #7: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
* 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 29s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 31,2s
Gradle task assembleDebug failed with exit code 1
代碼沒有改變(lib/main.dart):
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has
// changed in this State, which causes it to rerun the build method below
// so that the display can reflect the updated values. If we changed
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear to happen.
_counter++;
});
}
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
// Column is also a layout widget. It takes a list of children and
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Invoke "debug painting" (press "p" in the console, choose the
// "Toggle Debug Paint" action from the Flutter Inspector in Android
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
// to see the wireframe for each widget.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.display1,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
./android/build.gradle:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
./android/app/build.gradle:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "pl.my.app-phrog"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
./android/gradle.properties:
org.gradle.jvmargs=-Xmx4608M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
顫振醫生:
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.17134.1069], locale pl-PL)
• Flutter version 1.12.13+hotfix.5 at (...)
• Framework revision 27321ebbad (4 weeks ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at (...)
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = (...)
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.
[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[√] VS Code (version 1.41.1)
• VS Code at (...)
• Flutter extension version 3.7.1
[√] Connected device (1 available)
• SM J730F • android-arm • Android 9 (API 28)
• No issues found!
Gradle 堆棧跟蹤:
#0 throwToolExit (package:flutter_tools/src/base/common.dart:28:3)
#1 buildGradleApp (package:flutter_tools/src/android/gradle.dart:431:7)
#2 _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:73:64)
#3 _rootRunUnary (dart:async/zone.dart:1134:38)
#4 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
#5 _FutureListener.handleValue (dart:async/future_impl.dart:139:18)
#6 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:680:45)
#7 Future._propagateToListeners (dart:async/future_impl.dart:709:32)
#8 Future._completeWithValue (dart:async/future_impl.dart:524:5)
#9 Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:554:7)
#10 _rootRun (dart:async/zone.dart:1126:13)
#11 _CustomZone.run (dart:async/zone.dart:1023:19)
#12 _CustomZone.runGuarded (dart:async/zone.dart:925:7)
#13 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:965:23)
#14 _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
#15 _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
#16 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#17 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:175:5)
編輯:我已經使用詳細選項運行命令:
$ flutter run -v
[ +63 ms] executing: [...\flutter\] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +264 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +4 ms] 27321ebbad34b0a3fafe99fac037102196d655ff
[ +1 ms] executing: [...\flutter\] git describe --match v*.*.* --first-parent --long --tags
[ +231 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[ ] v1.12.13+hotfix.5-0-g27321ebba
[ +13 ms] executing: [...\flutter\] git rev-parse --abbrev-ref --symbolic @{u}
[ +213 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ +1 ms] origin/stable
[ +1 ms] executing: [...\flutter\] git ls-remote --get-url origin
[ +210 ms] Exit code 0 from: git ls-remote --get-url origin
[ +1 ms] https://github.com/flutter/flutter.git
[ +294 ms] executing: [...\flutter\] git rev-parse --abbrev-ref HEAD
[ +219 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ +1 ms] stable
[ +232 ms] executing: ...\Android\Sdk\platform-tools\adb.exe devices -l
[ +112 ms] Exit code 0 from: ...\Android\Sdk\platform-tools\adb.exe devices -l
[ +1 ms] List of devices attached
52009f78e2ae3433 device product:j7y17ltexx model:SM_J730F device:j7y17lte transport_id:6
[ +34 ms] ...\Android\Sdk\platform-tools\adb.exe -s 52009f78e2ae3433 shell getprop
[ +228 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[ +28 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.
[ +9 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ +1 ms] 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.
[ +903 ms] Generating ...\hello_world_flutter\new_hello_flutter\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java
[ +111 ms] ro.hardware = samsungexynos7870
[ +140 ms] Launching lib\main.dart on SM J730F in debug mode...
[ +28 ms] executing: ...\Android\Sdk\platform-tools\adb.exe -s 52009f78e2ae3433 shell -x logcat -v time -s flutter
[ +13 ms] executing: ...\Android\Sdk\platform-tools\adb.exe version
[ +158 ms] Android Debug Bridge version 1.0.41
Version 29.0.5-5949299
Installed as ...\Android\Sdk\platform-tools\adb.exe
[ +5 ms] executing: ...\Android\Sdk\platform-tools\adb.exe start-server
[ +120 ms] Building APK
[ +42 ms] Running Gradle task 'assembleDebug'...
[ +5 ms] gradle.properties already sets `android.enableR8`
[ +10 ms] Using gradle from ...\hello_world_flutter\new_hello_flutter\android\gradlew.bat.
[ +35 ms] executing: C:\Program Files\Android\Android Studio\jre\bin\java -version
[ +784 ms] Exit code 0 from: C:\Program Files\Android\Android Studio\jre\bin\java -version
[ +1 ms] openjdk version "1.8.0_202-release"
OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
OpenJDK 64-Bit Server VM (build 25.202-b03, mixed mode)
[ +8 ms] executing: [...\hello_world_flutter\new_hello_flutter\android\] ...\hello_world_flutter\new_hello_flutter\android\gradlew.bat
-Pverbose=true -Ptarget=...\hello_world_flutter\new_hello_flutter\lib\main.dart -Ptrack-widget-creation=true -Pfilesystem-scheme=org-dartlang-root
-Ptarget-platform=android-arm assembleDebug
[+5300 ms] Starting a Gradle Daemon (subsequent builds will be faster)
[+33942 ms] > Task :app:compileFlutterBuildDebug
[ +2 ms] [ +52 ms] executing: [...\flutter\] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +295 ms] [ +277 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +1 ms] [ +2 ms] 27321ebbad34b0a3fafe99fac037102196d655ff
[ +1 ms] [ ] executing: [...\flutter\] git describe --match v*.*.* --first-parent --long --tags
[ +196 ms] [ +232 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[ +1 ms] [ ] v1.12.13+hotfix.5-0-g27321ebba
[ +1 ms] [ +15 ms] executing: [...\flutter\] git rev-parse --abbrev-ref --symbolic @{u}
[ +196 ms] [ +228 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ +1 ms] [ ] origin/stable
[ +1 ms] [ ] executing: [...\flutter\] git ls-remote --get-url origin
[ +309 ms] [ +214 ms] Exit code 0 from: git ls-remote --get-url origin
[ +3 ms] [ ] https://github.com/flutter/flutter.git
[ +285 ms] [ +369 ms] executing: [...\flutter\] git rev-parse --abbrev-ref HEAD
[ +300 ms] [ +238 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ +1 ms] [ ] stable
[ +1 ms] [ +47 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.
[ +2 ms] [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ +1 ms] [ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +1 ms] [ +9 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.
[ +1 ms] [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ +1 ms] [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +181 ms] [ +187 ms] Initializing file store
[ +100 ms] [ +61 ms] Done initializing file store
[+2999 ms] [+3011 ms] Skipping target: kernel_snapshot
[ +199 ms] [ +173 ms] debug_android_application: Starting due to {InvalidatedReason.outputMissing}
[ +799 ms] [ +841 ms] debug_android_application: Complete
[ +1 ms] [ +35 ms] Persisting file store
[ +98 ms] [ +26 ms] Done persisting file store
[ +1 ms] [ +7 ms] build succeeded.
[ +1 ms] [ +29 ms] "flutter assemble" took 4 670ms.
[ +315 ms] > Task :app:packLibsflutterBuildDebug UP-TO-DATE
[ +3 ms] > Task :app:preBuild UP-TO-DATE
[ +3 ms] > Task :app:preDebugBuild UP-TO-DATE
[ +74 ms] > Task :app:checkDebugManifest UP-TO-DATE
[ +124 ms] > Task :app:generateDebugBuildConfig UP-TO-DATE
[ +3 ms] > Task :app:compileDebugAidl NO-SOURCE
[ +1 ms] > Task :app:compileDebugRenderscript NO-SOURCE
[ +170 ms] > Task :app:cleanMergeDebugAssets
[ +2 ms] > Task :app:mergeDebugShaders UP-TO-DATE
[ +96 ms] > Task :app:compileDebugShaders UP-TO-DATE
[ +1 ms] > Task :app:generateDebugAssets UP-TO-DATE
[ +98 ms] > Task :app:mergeDebugAssets
[ +628 ms] > Task :app:copyFlutterAssetsDebug
[ +15 ms] > Task :app:mainApkListPersistenceDebug UP-TO-DATE
[ +1 ms] > Task :app:generateDebugResValues UP-TO-DATE
[ +1 ms] > Task :app:generateDebugResources UP-TO-DATE
[+4174 ms] > Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
[ +208 ms] > Task :app:processDebugManifest UP-TO-DATE
[ +369 ms] > Task :app:mergeDebugResources FAILED
[ +103 ms] FAILURE: Build failed with an exception.
[ +9 ms] * What went wrong:
[ +2 ms] Execution failed for task ':app:mergeDebugResources'.
[ +2 ms] > Multiple task action failures occurred:
[ +2 ms] > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
[ +2 ms] > AAPT2 aapt2-3.5.2-5435860-windows Daemon #1: Daemon startup failed
[ +1 ms] This should not happen under normal circumstances, please file an issue if it does.
[ +2 ms] > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
[ +1 ms] > AAPT2 aapt2-3.5.2-5435860-windows Daemon #4: Daemon startup failed
[ +2 ms] This should not happen under normal circumstances, please file an issue if it does.
[ +3 ms] > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
[ +2 ms] > AAPT2 aapt2-3.5.2-5435860-windows Daemon #3: Daemon startup failed
[ +4 ms] This should not happen under normal circumstances, please file an issue if it does.
[ +2 ms] > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
[ +8 ms] > AAPT2 aapt2-3.5.2-5435860-windows Daemon #5: Daemon startup failed
[ +21 ms] This should not happen under normal circumstances, please file an issue if it does.
[ +18 ms] > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
[ +33 ms] > AAPT2 aapt2-3.5.2-5435860-windows Daemon #6: Daemon startup failed
[ +10 ms] This should not happen under normal circumstances, please file an issue if it does.
[ +2 ms] > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
[ +2 ms] > AAPT2 aapt2-3.5.2-5435860-windows Daemon #0: Daemon startup failed
[ +17 ms] This should not happen under normal circumstances, please file an issue if it does.
[ +12 ms] > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
[ +28 ms] > AAPT2 aapt2-3.5.2-5435860-windows Daemon #2: Daemon startup failed
[ +4 ms] This should not happen under normal circumstances, please file an issue if it does.
[ +4 ms] > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
[ +20 ms] > AAPT2 aapt2-3.5.2-5435860-windows Daemon #7: Daemon startup failed
[ +4 ms] This should not happen under normal circumstances, please file an issue if it does.
[ +3 ms] * Try:
[ +3 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.
[ +8 ms] * Get more help at https://help.gradle.org
[ +8 ms] BUILD FAILED in 51s
[ +1 ms] 14 actionable tasks: 5 executed, 9 up-to-date
[ +616 ms] Running Gradle task 'assembleDebug'... (completed in 53,3s)
[ +15 ms] "flutter run" took 55 781ms.
Gradle task assembleDebug failed with exit code 1
編輯 2:我已經為 x64 和 ARM 安裝了 VC redist(最新的 2019)。 重啟后依然出現錯誤: https : //pastebin.com/2Jiea3wq
編輯 3:在沒有快速啟動的情況下重新啟動后,我已經完成了flutter clean
和flutter build apk -v
並且出現了相同的錯誤,但我看到了這個(pastebin 中的第 87 行):
invalidated build due to missing files: .\flutter\bin\cache\artifacts\engine\android-arm-release\windows-x64\gen_snapshot
這是個問題嗎? 完整日志: https : //pastebin.com/vYvLzStv
android-arm64-release
用於發布版本,而mergeDebugResources
是來自調試版本的任務。 如果任何日志會很有趣,那就是(當它無法啟動 AAPT2 時,這可能與其他日志一樣無意義):
gradlew.bat --stacktrace assembleDebug
當AAPT2失敗,任務mergeDebugResources
,也許是資源有過錯。
GRADLE_USER_HOME
設置為環境變量。即使選項 #1 不太可能用於某些“hello world”程序......我建議嘗試構建一個常規的 Android 項目......只是為了擺脫所有 Flutter 復雜性,以便查看 AAPT2 是否甚至啟動。
通常這意味着您缺少 windows 通用 C 運行時庫。 但是,由於您聲明您使用的是 Windows 10,因此您的系統似乎由於某種原因缺少這個 C 運行時庫,即使它應該已經安裝(或在更新中)。 您可以通過從此處安裝 Microsoft Visual C++ Redistributable for Visual Studio(當前 2019)來獲取此缺少的庫。
最后我知道是什么導致了問題:在其他地方運行程序是有限制的,然后是Program Files
, Program Data
等。 在Android Studio
示例項目中設置並flutter run -v
我看到了錯誤消息:
this program is blocked by group policy. for more information contact your system administrator
我已經在管理控制台中運行了flutter run -v
並且它起作用了。 我認為gradle
嘗試在c:\\users\\<user>\\.gradle
下載並運行某c:\\users\\<user>\\.gradle
- 有誰知道如何解決這個問題?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.