Ladybug | 2024.2.1
AGP 3.2-8.7 8.7.3
gradle 最低8.9
1、JDK
- Gradle JDK 17
- 如果是Android Studio编译,需要把File->Settings->Gradle jdk设置为17
- 如果是命令行编译,需要把环境变量设置为jdk17
- compile JDK
build.gradle
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
2、gradle版本
gradle version 8.9
Android Gradle Plugin Version 8.7.3
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
[versions]
agp = "8.7.3"
[libraries]
gradle = { module = "com.android.tools.build:gradle", version.ref = "agp" }
3、应用版本
compileSdk = 35
minSdk = 23
targetSdk = 34
Android Studio Koala Feature Drop | 2024.1.2
AGP 3.2-8.6 8.6.1
gradle 最低8.7
1、JDK
- Gradle JDK 17
- 如果是Android Studio编译,需要把File->Settings->Gradle jdk设置为17
- 如果是命令行编译,需要把环境变量设置为jdk17
- compile JDK
build.gradle
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
2、gradle版本
gradle version 8.7
Android Gradle Plugin Version 8.6.1
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
[versions]
agp = "8.6.1"
[libraries]
gradle = { module = "com.android.tools.build:gradle", version.ref = "agp" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
3、应用版本
compileSdk = 35
minSdk = 24
targetSdk = 34
Android Studio Giraffe | 2022.3.1 Patch 1
1、JDK
- Gradle JDK 17
- 如果是Android Studio编译,需要把File->Project Structure->Gradle jdk设置为17
- 如果是命令行编译,需要把环境变量设置为jdk17
- compile JDK
build.gradle
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
kotlinOptions {
jvmTarget = '11'
}
}
2、gradle版本
gradle version 8.0
Android Gradle Plugin Version 8.0.2
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
classpath 'com.android.tools.build:gradle:8.0.2'
3、应用版本
compileSdkVersion = 33
buildToolsVersion = "30.0.0"
minSdkVersion = 21
targetSdkVersion = 26
4、Android Studio Jellyfish或Giraffe编译异常
参见第2条,编译jdk是11,需要在gradlesdk处下载jdk11,下载到默认路径Users\winaccount.jdks\下即可。以便AndroidStudio可以正常识别。
注意:下载完jdk11(只是下载),不要把gradle jdk版本选择jdk11,而还是选择jdk17。
Multiple build operations failed.
Could not create task ':apmlibrary:compileDebugJavaWithJavac'.
Could not create task ':app:compileDebugJavaWithJavac'.
Could not create task ':ComposeUI:compileDebugJavaWithJavac'.
Could not create task ':CpBlindBox:compileDebugJavaWithJavac'.
Could not create task ':CPStrategy:compileDebugJavaWithJavac'.
Could not create task ':Finder:compileDebugJavaWithJavac'.
Could not create task ':glide:compileDebugJavaWithJavac'.
Could not create task ':infra:compileDebugJavaWithJavac'.
Could not create task ':Permission:compileDebugJavaWithJavac'.
Could not create task ':pictureselector:compileDebugJavaWithJavac'.
...and 9 more failures.
Could not create task ':apmlibrary:compileDebugJavaWithJavac'.
Failed to calculate the value of task ':apmlibrary:compileDebugJavaWithJavac' property 'javaCompiler'.
No matching toolchains found for requested specification: {languageVersion=11, vendor=any, implementation=vendor-specific}.
No locally installed toolchains match (see https://docs.gradle.org/8.0/userguide/toolchains.html#sec:auto_detection) and toolchain download repositories have not been configured (see https://docs.gradle.org/8.0/userguide/toolchains.html#sub:download_repositories).
5、内存配置
android studio设置内存大小
包含3块,gradle、jvm和androidstudio,目前配置都是4G。AndroidStudio默认是1280M,如果不改,用一会就卡了。
AndroidStudio默认是1280M可能是在studio64.exe.vmoptions -Xmx1280m设置的,待验证
您可以在 Android Studio 中调整 JVM(Java 虚拟机)的内存大小来提升程序的运行效率。要调整 JVM 内存大小,您需要在 Android Studio 中进行如下设置:
1.在菜单栏中,依次点击 “File” > “Settings”。
2.在 “Settings” 窗口中,找到 “Appearance & Behavior” > “System Settings” > “Memory Settings”。
3.在 “Maximum heap size” 中输入您想要设置的内存大小(单位为 MB)。
4.点击 “Apply” 按钮保存设置。
注意:
- 内存设置过大会导致系统资源浪费,影响系统性能。
- 内存设置过小会导致程序运行速度减慢甚至崩溃。
建议您根据自己的系统资源和项目需求来调整内存大小。
参考
Android Studio Electric Eel | 2022.1.1
2003之前使用
1、JDK
- Gradle JDK 1.8
- compile JDK
build.gradle
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
2、gradle版本
gradle version 6.7.1
Android Gradle Plugin Version 4.2.1
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
classpath 'com.android.tools.build:gradle:4.2.1'
3、应用版本
compileSdkVersion = 30
buildToolsVersion = "30.0.2"
minSdkVersion = 21
targetSdkVersion = 26
版本依赖关系
版本号配置修改
Android Studio Koala各种版本傻傻分不清
官网
Android Studio版本依赖AGP版本
Android Studio 版本 | 时间 | 所需的 AGP 版本 |
---|---|---|
Ladybug | 2024.2.1 | 3.2-8.7 |
Koala 功能更新 | 2024.1.2 | 3.2-8.6 |
Koala | 2024.1.1 | 3.2-8.5 |
Jellyfish | 2023.3.1 | 3.2-8.4 |
Iguana | 2023.2.1 | 3.2-8.3 |
Hedgehog | 2023.1.1 | 3.2-8.2 |
Giraffe | 2022.3.1 | 3.2-8.1 |
Flamingo | 2022.2.1 | 3.2-8.0 |
AGP插件版本依赖Gradle版本
插件版本 | 所需的最低 Gradle 版本 |
---|---|
8.7 | 8.9 |
8.6 | 8.7 |
8.5 | 8.7 |
8.4 | 8.6 |
8.3 | 8.4 |
8.2 | 8.2 |
8.1 | 8.0 |
8.0 | 8.0 |
7.4 | 7.5 |