首页 > 解决方案 > Flutter Android 资源链接失败,无法应用插件 [id 'kotlin-android']

问题描述

2个月后打开一个项目,出现空安全错误更改了一些插件,并升级了其他插件,一件事导致了另一件事,现在我被这个错误困住了!

尝试 Flutter clean 并删除 build 和 .gradle 文件夹,但没有任何效果。

    Launching lib\main.dart on RMX1801 in debug mode...
    lib\main.dart:1
    3
    registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
    
    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
         C:\Users\Dell\.gradle\caches\transforms-2\files-2.1\b94a6b46912fba96397655c3d1ce5de0\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
    
    BUILD FAILED in 8m 59s
    The build failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetifier to solve the incompatibility.
    Building plugin audioplayers...
    Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
    
    FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\Dell\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.18.2\android\build.gradle' line: 25

* What went wrong:
A problem occurred evaluating root project 'audioplayers'.
> Failed to apply plugin [id 'kotlin-android']
   > The current Gradle version 4.10.2 is not compatible with the Kotlin Gradle plugin. Please use Gradle 5.3 or newer, or the previous version of the Kotlin plugin.

* 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 54s
2

Exception: The plugin audioplayers could not be built due to the issue above.
Exited (sigterm)

标签: androidflutterkotlindartgradle

解决方案


你得到一个AAPT: error: unexpected element <queries> found in <manifest>.看起来你必须将你的 gradle 版本更新到此处列出的版本之一

https://github.com/miguelpruivo/flutter_file_picker/wiki/Troubleshooting

3.3.3

3.4.3

3.5.4

3.6.4

4.0.1

由于您使用的是 4.10.2,因此您似乎需要降级您的 gradle 版本


推荐阅读