gpt4 book ai didi

android - 失败 : Build failed with an exception in flutter

转载 作者:IT王子 更新时间:2023-10-29 06:58:54 28 4
gpt4 key购买 nike

我的 flutter 应用程序突然出现问题。出于某种原因,我无法运行任何 flutter 文件。每次我尝试运行我的任何 Flutter 项目时,它都会给我一条错误消息。

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':flutter_appavailability:androidApis'.
> Failed to transform file 'android.jar' to match attributes {artifactType=android-platform-attr} using transform PlatformAttrTransform
> java.io.FileNotFoundException: /Users/wooyoung/Library/Android/sdk/platforms/android-27/android.jar (No such file or directory)

* Try:
Run with --stacktrace option to get the stack trace. Run with the -the-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 3s
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

所以,我制作了一个新的 flutter 应用程序来测试它是否只是我项目中的一个问题。但是它又给了我一个错误。

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Android resource linking failed
Output: W/ziparchive(29306): Unable to open '/Users/wooyoung/Library/Android/sdk/platforms/android-27/android.jar': No such file or directory
error: failed to open APK: I/O error.

Command:
/Users/wooyoung/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/7624077eb86a2607fdc7dac1f332a5dd/aapt2-3.2.1-4818971-osx/aapt2 link -I\
/Users/wooyoung/Library/Android/sdk/platforms/android-27/android.jar\
--manifest\
/Users/wooyoung/Flutter/FlutterProjects/Experiment/j/build/app/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml\
-o\
/Users/wooyoung/Flutter/FlutterProjects/Experiment/j/build/app/intermediates/processed_res/debug/processDebugResources/out/resources-debug.ap_\
-R\
@/Users/wooyoung/Flutter/FlutterProjects/Experiment/j/build/app/intermediates/incremental/processDebugResources/resources-list-for-resources-debug.ap_.txt\
--auto-add-overlay\
--java\
/Users/wooyoung/Flutter/FlutterProjects/Experiment/j/build/app/generated/not_namespaced_r_class_sources/debug/processDebugResources/r\
--custom-package\
com.example.j\
-0\
apk\
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.1-4818971-osx Daemon #0

* 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 2s
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)


我该如何解决这个问题?

最佳答案

您的 Android SDK 目录中似乎缺少必要的 Android 27 API。转到 ~/library/android/sdk/tools/bin 并运行 sdkmanager --list 检查你是否有 platform-toolsplatforms;android-27 安装。如果没有,那么您可以通过运行 sdkmanager "platform-tools""platforms;android-27"

安装它们

如果您有 Android Studio,那么您也可以通过 Android Studio 的 GUI 安装它们。

关于android - 失败 : Build failed with an exception in flutter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54244959/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com