首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >更改compileSdkVersion后,颤振应用程序无法运行

更改compileSdkVersion后,颤振应用程序无法运行
EN

Stack Overflow用户
提问于 2021-01-13 08:01:53
回答 1查看 1.1K关注 0票数 0

我更改了我的文件build.gradle

出发地:

代码语言:javascript
复制
compileSdkVersion 29
minSdkVersion 16
targetSdkVersion 29

To:

代码语言:javascript
复制
compileSdkVersion 28
minSdkVersion 18
targetSdkVersion 29

然后用消息获取错误:

代码语言:javascript
复制
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.
EN

回答 1

Stack Overflow用户

发布于 2021-01-13 08:20:28

你能试试这个方法吗。

下面是: android/app/build.gradle

代码语言:javascript
复制
android {
   compileSdkVersion 29

  defaultconfig{
   minSdkVersion:21
   targetSdkVersion 29

下面是: android/build.gradle

代码语言:javascript
复制
 afterEvaluate {project ->

       if (project.hasProperty("android") && 
   project.property("android").compileSdkVersion.equals("android-R")) {

        android {

            compileSdkVersion 30

        }

    }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65697787

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档