我更改了我的文件build.gradle
出发地:
compileSdkVersion 29
minSdkVersion 16
targetSdkVersion 29To:
compileSdkVersion 28
minSdkVersion 18
targetSdkVersion 29然后用消息获取错误:
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
D:\Development\Projects\Dart\Flutter\tires\build\location\intermediates\library_manifest\debug\AndroidManifest.xml:13:9-17:56: AAPT: error: attribute android:foregroundServiceType 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 22s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 23,1s
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 flutter_plugin_android_lifecycle...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 1,1s
D:\Development\Packages\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_plugin_android_lifecycle-1.0.11\android\src\main\java\io\flutter\embedding\engine\plugins\lifecycle\FlutterLifecycleAdapter.java:8: error: package androidx.lifecycle does not exist
import androidx.lifecycle.Lifecycle;
^
D:\Development\Packages\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_plugin_android_lifecycle-1.0.11\android\src\main\java\io\flutter\embedding\engine\plugins\lifecycle\FlutterLifecycleAdapter.java:22: error: cannot find symbol
public static Lifecycle getActivityLifecycle(
^
symbol: class Lifecycle
location: class FlutterLifecycleAdapter
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 0s
Exception: The plugin flutter_plugin_android_lifecycle could not be built due to the issue above.发布于 2021-01-13 08:20:28
你能试试这个方法吗。
下面是: android/app/build.gradle
android {
compileSdkVersion 29
defaultconfig{
minSdkVersion:21
targetSdkVersion 29下面是: android/build.gradle
afterEvaluate {project ->
if (project.hasProperty("android") &&
project.property("android").compileSdkVersion.equals("android-R")) {
android {
compileSdkVersion 30
}
}https://stackoverflow.com/questions/65697787
复制相似问题