构建失败可能是由于插件中的 AndroidX 不兼容。工具即将尝试使用Jetifier解决不兼容问题
The build failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetifier to solve the incompatibility
A 将 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,我仍然遇到同样的错误。
非常感谢任何帮助。谢谢
我做了三件事,其中一些解决了问题。
- 安装最新版本的音频播放器插件。
- 使用 Android Studio 和 Build -> Rebuild Project 打开 android 文件夹
- 从 Android 工作室,将 Gradle 从 3.x.x 更新为 5.x.x
A 将 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,我仍然遇到同样的错误。
非常感谢任何帮助。谢谢
我做了三件事,其中一些解决了问题。
- 安装最新版本的音频播放器插件。
- 使用 Android Studio 和 Build -> Rebuild Project 打开 android 文件夹
- 从 Android 工作室,将 Gradle 从 3.x.x 更新为 5.x.x