【发布时间】:2021-11-01 16:54:26
【问题描述】:
将 google_mobile_ads 插件添加到我的 Flutter 项目后,当我尝试运行我的应用程序时出现以下错误。
Launching lib\main.dart on Android SDK built for x86 in debug mode...
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\Simon\.gradle\caches\transforms-2\files-2.1\fb3ac92d6ea8a3919475bb567eb91a20\core-1.7.0-alpha02\res\values\values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.
* 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 1m 18s
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:\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.19.0\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 3s
Exception: The plugin audioplayers could not be built due to the issue above.
Exited (sigterm)
奇怪的是,当我返回未添加 google_mobile_ads 的旧版本应用时,我仍然收到类似的错误。
我尝试过更改版本 类路径'com.android.tools.build:gradle:3.5.0' 在 build.gradle 从 3.5.0 到 4.0.1,我仍然得到同样的错误。
非常感谢任何帮助。谢谢
【问题讨论】:
-
升级你的 gradle 版本。
-
文件 -> 打开 -> Android 文件夹让它构建然后尝试运行。
-
非常感谢
标签: flutter admob flutter-dependencies flutter-plugin googlemobileads