【问题标题】:BUILD FAILED in 6s Exception: Gradle task assembleDebug failed with exit code 1BUILD 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

标签: flutter dart visual-studio-code build.gradle flutter-android


【解决方案1】:

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

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-11-06
    • 1970-01-01
    • 2020-06-22
    • 1970-01-01
    • 1970-01-01
    • 2021-12-30
    • 2021-04-06
    • 2020-08-22
    相关资源
    最近更新 更多