BUILD FAILED in 6s Exception: Gradle task assembleDebug failed with exit code 1

Posted

技术标签:

【中文标题】BUILD FAILED in 6s Exception: Gradle task assembleDebug failed with exit code 1【英文标题】: 【发布时间】:2021-09-04 08:21:29 【问题描述】:

当我尝试在 Android 模拟器中运行我的 Flutter 应用时,它会引发以下异常:

Launching lib/main.dart on sdk gphone x86 in debug mode...
lib/main.dart:1

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
     /Users/divyesh12/Documents/Development /GitRepos/Shopapp_flutter/myshop_app/build/app/intermediates/packaged_manifests/debug/AndroidManifest.xml:23: AAPT: error: unexpected element <uses-permission> found in <manifest><application>.

扑医生结果:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.6, on Mac OS X 10.15.6 19G73 darwin-x64, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for ios and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.57.1)
[✓] Connected device (2 available)
• No issues found!

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myste_app">
    <!-- Flutter needs it to communicate with the running application
         to allow setting breakpoints, to provide hot reload, etc.
    -->
    <uses-permission android:name="android.permission.INTERNET"/>
</manifest>

注意:它在 iOS 中运行良好,如何解决这个问题?

【问题讨论】:

错误在您的调试AndroidManifest.xml 文件中。您可以在android\app\src\debug\AndroidManifest.xml 中找到它。请将其内容添加到问题中。 我在这里添加了 Manifest 文件内容。 @Andrej 【参考方案1】:

您可能在错误的 xml 文件中添加了权限。

您应该编辑此路径中的 xml 文件以添加权限:

\android\app\src\main\AndroidManifest.xml

【讨论】:

以上是关于BUILD FAILED in 6s Exception: Gradle task assembleDebug failed with exit code 1的主要内容,如果未能解决你的问题,请参考以下文章

VUE 打包 Module build failed: Error: No PostCSS Config found in

移动vue项目,启动错误:Module build failed: Error: No PostCSS Config found in:

运行`detox build -c android.emu.debug`任务时出错:app:compileDebugJavaWithJavac FAILED in react native

编译JDK11:ERROR: Build failed for target ‘default (exploded-image)‘ in configuration ‘windows-x86_64

ubuntu下安装pandas出现 compile failed with error code 1 in /tmp/pip_build_hadoop/pandas

pip install faling with error gevent failed with error code 1 in /private/tmp/pip-build-muEt66/geven