Correspondence between Android studio and gradle plug-in versions (reprinted)

Correspondence between Android studio and gradle plugin versions (2022)

Official website link: Android Gradle Plugin Release Notes | Android Developers | Android Developers

Due to network problems, after updating the Android studio version, the gradle cannot be obtained synchronously, so you need to go to Gradle Distributions to download it yourself, but after seeing the dense gradle version, your scalp is numb, so record Android studio here Correspondence with gradle

 

 Tip: The version after AGP (Android Gradle Plugin) 4.2 is version 7.0, and will require an upgrade to Gradle version 7.x. Every major release of AGP will require a major version upgrade in the underlying Gradle tools.

The specific version and the corresponding java version

49 = Java 5
50 = Java 6
51 = Java 7
52 = Java 8
53 = Java 9
54 = Java 10
55 = Java 11
56 = Java 12
57 = Java 13
58 = Java 14

For good network conditions, you can directly obtain gradle, and modify the version number corresponding to the corresponding build.gradle

Modify the version number in gradle/wrapper/gradle-wrapper.properties in the project to the target version to replace the target

 Wait here and you're done.

The above is the modification method before version 4.2. Now after updating to 4.2, the gradle version must be changed to 7.0+ or ​​above.

Projects created after the latest version of AS (Android Studio) may fail to compile or have problems with long compilation times. If you also have such problems, you may wish to reconfigure the project in the following way

1. Modify the Gradle JDK 

 Because the JDK I installed is version 1.8 , the jre selected by the new version of AS is no longer applicable. Select the jre path that comes with the AS that is boxed in the figure and apply->ok, then recompile and try again.

2. After upgrading to version 4.2+ , the build.gradle in the project-level directory is not in the reference area of ​​repositories, and all the functions have been moved to the setting.gradle file. If the compilation is too slow, you can try to improve it by replacing the image:

pluginManagement {
    repositories {
        mavenLocal()
        mavenCentral()
        maven { url 'https://jitpack.io' }
        maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' }
        maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }
        maven { url 'https://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
    }
}


I hope the above can help my dear friends.

Original link

Guess you like

Origin blog.csdn.net/qq_37888591/article/details/127231308