Home > Blockchain >  What version of Gradle plugin do I use in my Android app?
What version of Gradle plugin do I use in my Android app?

Time:10-19

I have the following build.gradle in my Android app:

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"
}

and get a warining:

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

But when I try to use Gradle plugin 7.4 I get this:

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 

with 7.2 I get this:

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

What is happening?

EDIT1

If I spefify 7.3.1 version in build.gradle I get the following strange error message:

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

What can it be?

CodePudding user response:

Version 7.4 of the Android Gradle plugin doesn't exist, the latest stable version is 7.3.1, as you can see in the Google's Maven repo index. Other versions you could use are 7.4.0-beta02 and 8.0.0-alpha05.

  • Related