Android升级版本兼容问题

1、JDK的选择

Android Java API and language features supported
14 (API 34) 17 Core libraries
13 (API 33) 11 Core libraries
12 (API 32) 11 Java API
11 and lower Android versions

https://developer.android.com/build/jdks

The following table lists which version of Gradle is required for each version of the Android Gradle plugin. For the best performance, you should use the latest possible version of both Gradle and the plugin.

Plugin version Minimum required Gradle version
8.4 (alpha) 8.6-rc-1
8.3 (beta) 8.4
8.2 8.2
8.1 8.0
8.0 8.0
7.4 7.5

The following table lists which version of Android Gradle plugin(AGP) is required for each version of Android Studio.

Android Studio version Required AGP version
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
Electric Eel - 2022.1.1 3.2-7.4

The minimum versions of Android Studio and AGP are as follows:

API level Minimum Android Studio version Minimum AGP version
34 Hedgehog - 2023.1.1 8.1.1
33 Flamingo - 2022.2.1 7.2

https://developer.android.com/build/releases/gradle-plugin

Make sure to choose a JDK version that is higher than or equal to the JDK versions used by plugins that you use in your Gradle build. To determine the minimum required JDK version for the Android Gradle Plugin (AGP), see the compatibility table in the release notes.

For example, the Android Gradle Plugin version 8.x requires JDK 17. If you try to run a Gradle build that uses it with an earlier version of the JDK, it reports a message like:

An exception occurred applying plugin request [id: 'com.android.application']

Failed to apply plugin 'com.android.internal.application'.

Android Gradle plugin requires Java 17 to run. You are currently using Java 11.

Your current JDK is located in /usr/local/buildtools/java/jdk11

You can try some of the following options:

  • changing the IDE settings.

  • changing the JAVA_HOME environment variable.

  • changing org.gradle.java.home in gradle.properties.

相关推荐
Propeller27 分钟前
【Android】View 交互的事件处理机制
android·java
吴Wu涛涛涛涛涛Tao29 分钟前
Flutter 实现「可拖拽评论面板 + 回复输入框 + @高亮」的完整方案
android·flutter·ios
雨声不在33 分钟前
使用android studio分析cpu开销
android·ide·android studio
程序leo源2 小时前
Linux_基础指令(二)
android·linux·运维·服务器·青少年编程
雨白4 小时前
Android 两种拖拽 API 详解:ViewDragHelper 和 OnDragListener 的原理与区别
android
元亓亓亓4 小时前
JavaWeb--day3--Ajax&Element&路由&打包部署
android·ajax·okhttp
居然是阿宋4 小时前
Android XML属性与Jetpack Compose的对应关系(控件基础属性篇)
android
GoatJun4 小时前
Android ScrollView嵌套RecyclerView 导致RecyclerView数据展示不全问题
android
潜龙95275 小时前
第6.2节 Android Agent开发<二>
android·python·覆盖率数据