首页 > 解决方案 > Flutter Stable 1.22.6 无法构建 apk

问题描述

我正在尝试使用颤振稳定版本 1.22.6 构建 apk,但在下面不断出现错误;

错误

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed
     C:\Users\emirk\.gradle\caches\transforms-2\files-2.1\3dd4f179ab5210ef1c86848f5b37a403\play-services-ads-lite-19.6.0\AndroidManifest.xml:27:5-38:15: AAPT: error: unexpected element <queries> found in <manifest>.


* 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

BU�LD FAILED in 15s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done                      16,4s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin cloud_firestore...
The plugin cloud_firestore could not be built due to the issue above.  

所以我跑了 Flutter Doctor,这是 Flutter Doctor 的结果,

[√] Flutter (Channel stable, 1.22.6, on Microsoft Windows [Version 10.0.19042.746], locale tr-TR)
 
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[!] Android Studio (version 4.1.0)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code, 64-bit edition (version 1.52.1)
[√] Connected device (1 available)

知道为什么会这样吗?

标签: flutterapkversion

解决方案


将您的代码迁移到 AndroidX 希望它能解决问题https://flutter.dev/docs/development/androidx-migration


推荐阅读