前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >【错误记录】Android Studio 编译时 lint 检查报错 ( Error: Google Play requires that apps target API level 29 or )

【错误记录】Android Studio 编译时 lint 检查报错 ( Error: Google Play requires that apps target API level 29 or )

作者头像
韩曙亮
发布2023-03-30 15:26:38
3.3K0
发布2023-03-30 15:26:38
举报
文章被收录于专栏:韩曙亮的移动开发专栏

文章目录

一、报错信息


Android Studio 编译打包时 , 报如下错误 :

代码语言:javascript
复制
Error: Google Play requires that apps target API level 29 or higher.
 [ExpiredTargetSdkVersion]
        targetSdkVersion 28
        ~~~~~~~~~~~~~~~~~~~

   Explanation for issues of type "ExpiredTargetSdkVersion":
   As of the second half of 2018, Google Play requires that new apps and app
   updates target API level 26 or higher.

   Configuring your app to target a recent API level ensures that users
   benefit from significant security and performance improvements, while still
   allowing your app to run on older Android versions (down to the
   minSdkVersion).

   To update your targetSdkVersion, follow the steps from "Meeting Google Play
   requirements for target API level",
   https://developer.android.com/distribute/best-practices/develop/target-sdk.
   html

   https://support.google.com/googleplay/android-developer/answer/113469#targetsdk
   https://support.google.com/googleplay/android-developer/answer/113469#targetsdk
   https://developer.android.com/distribute/best-practices/develop/target-sdk.html

1 errors, 0 warnings

> Task :app:lintVitalRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
> Lint found fatal errors while assembling a release target.
  
  To proceed, either fix the issues identified by lint, or modify your build script as follows:
  ...
  android {
      lintOptions {
          checkReleaseBuilds false
          // Or, if you prefer, you can continue to check for errors in release builds,
          // but continue the build even when errors are found:
          abortOnError false
      }
  }
  ...

* 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 3s
在这里插入图片描述
在这里插入图片描述

二、解决方案


Google Play 上架时 , 要求应用的 " target API level " 必须大于等于

29

, 这里如果不需要再 GP 上上架时 , 直接关闭 lint 检查即可 ;

在 " build.gradle # android # lintOptions " 进行如下配置 :

代码语言:javascript
复制
  android {
      lintOptions {
          checkReleaseBuilds false
          // Or, if you prefer, you can continue to check for errors in release builds,
          // but continue the build even when errors are found:
          abortOnError false
      }
  }
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022-05-12,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 文章目录
  • 一、报错信息
  • 二、解决方案
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档