首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我在我的Android应用程序中使用什么版本的Gradle插件?

我在我的Android应用程序中使用什么版本的Gradle插件?
EN

Stack Overflow用户
提问于 2022-10-19 09:37:44
回答 1查看 137关注 0票数 1

我的安卓应用程序中有以下build.gradle

代码语言:javascript
复制
buildscript {
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.2'
    }
}

repositories {
    google()
    mavenCentral()
}

apply plugin: 'com.android.application'

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
    implementation 'com.google.android.gms:play-services-ads:21.3.0'
    implementation "com.android.billingclient:billing:4.0.0"
}

然后发出警告:

代码语言:javascript
复制
WARNING:We recommend using a newer Android Gradle plugin to use compileSdk = 33

This Android Gradle plugin (7.0.2) was tested up to compileSdk = 31

This warning can be suppressed by adding
    android.suppressUnsupportedCompileSdk=33
to this project's gradle.properties

The build will continue, but you are strongly encouraged to update your project to
use a newer Android Gradle Plugin that has been tested with compileSdk = 33

但是当我尝试使用Gradle插件7.4时,我得到了以下信息:

代码语言:javascript
复制
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android-build'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:7.4.
    Searched in the following locations:
    - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.4/gradle-7.4.pom
    - https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.4/gradle-7.4.pom
    Required by:
        project :

* 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 

用7.2我就知道了:

代码语言:javascript
复制
FAILURE: Build failed with an exception.

* Where:
Build file 'D:\dev\repos\examples\src\LinesGame\build-LinesGameQt-Android_Qt_6_4_0_x86_64_debug_Clang_x86_64-Debug\android-build\build.gradle' line: 17

* What went wrong:
A problem occurred evaluating root project 'android-build'.
> Failed to apply plugin 'com.android.internal.version-check'.
> Minimum supported Gradle version is 7.4. Current version is 7.2. If using the gradle wrapper, try editing the distributionUrl in D:\dev\repos\examples\src\LinesGame\build-LinesGameQt-Android_Qt_6_4_0_x86_64_debug_Clang_x86_64-Debug\android-build\gradle\wrapper\gradle-wrapper.properties to gradle-7.4-all.zip

* 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

这是怎么回事?

EDIT1

如果我在build.gradle中指定了7.3.1版本,就会得到以下奇怪的错误消息:

代码语言:javascript
复制
FAILURE: Build failed with an exception.

* Where:
Build file 'D:\dev\repos\examples\src\LinesGame\build-LinesGameQt-Android_Qt_6_4_0_x86_64_debug_Clang_x86_64-Debug\android-build\build.gradle' line: 17

* What went wrong:
A problem occurred evaluating root project 'android-build'.
> Failed to apply plugin 'com.android.internal.version-check'.
> Minimum supported Gradle version is 7.4. Current version is 7.2. If using the gradle wrapper, try editing the distributionUrl in D:\dev\repos\examples\src\LinesGame\build-LinesGameQt-Android_Qt_6_4_0_x86_64_debug_Clang_x86_64-Debug\android-build\gradle\wrapper\gradle-wrapper.properties to gradle-7.4-all.zip

* 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

它能是什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-10-19 09:44:10

Android插件的7.4版本并不存在,最新的稳定版本是7.3.1,正如您在谷歌的Maven回购索引中看到的那样。您可以使用的其他版本是7.4.0-beta028.0.0-alpha05

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

https://stackoverflow.com/questions/74123114

复制
相关文章

相似问题

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