Default to Android target-sdk-version 34, and support 35 (closes #1888)

34 is the minimum required version by Google Play, so it should be default.

Bumping to 34 and 35 requires updating both gradle-version and gradle-plugin-version.

The new versions now require an ndkVersion flag in build.gradle. This can be obtained by reading source.properties in the root of the NDK.

JDK 17 will be required for these updates. Previously required JDK 11.
This commit is contained in:
Josh Tynjala
2025-01-14 13:59:39 -08:00
parent 8bfc0be57e
commit 2e578d3e56
4 changed files with 29 additions and 4 deletions

View File

@@ -470,7 +470,7 @@ class AndroidPlatform extends PlatformTarget
context.OUTPUT_DIR = targetDirectory;
context.ANDROID_INSTALL_LOCATION = project.config.getString("android.install-location", "auto");
context.ANDROID_MINIMUM_SDK_VERSION = project.config.getInt("android.minimum-sdk-version", 21);
context.ANDROID_TARGET_SDK_VERSION = project.config.getInt("android.target-sdk-version", 30);
context.ANDROID_TARGET_SDK_VERSION = project.config.getInt("android.target-sdk-version", 34);
context.ANDROID_EXTENSIONS = project.config.getArrayString("android.extension");
context.ANDROID_PERMISSIONS = project.config.getArrayString("android.permission", [
"android.permission.WAKE_LOCK",
@@ -478,8 +478,8 @@ class AndroidPlatform extends PlatformTarget
"android.permission.VIBRATE",
"android.permission.ACCESS_NETWORK_STATE"
]);
context.ANDROID_GRADLE_VERSION = project.config.getString("android.gradle-version", "7.4.2");
context.ANDROID_GRADLE_PLUGIN = project.config.getString("android.gradle-plugin", "7.3.1");
context.ANDROID_GRADLE_VERSION = project.config.getString("android.gradle-version", "8.9");
context.ANDROID_GRADLE_PLUGIN = project.config.getString("android.gradle-plugin", "8.7.3");
context.ANDROID_USE_ANDROIDX = project.config.getString("android.useAndroidX", "true");
context.ANDROID_ENABLE_JETIFIER = project.config.getString("android.enableJetifier", "false");
@@ -529,6 +529,29 @@ class AndroidPlatform extends PlatformTarget
context.ANDROID_SDK_ESCAPED = StringTools.replace(context.ENV_ANDROID_SDK, "\\", "\\\\");
context.ANDROID_NDK_ROOT_ESCAPED = StringTools.replace(context.ENV_ANDROID_NDK_ROOT, "\\", "\\\\");
// we need to specify ndkVersion in build.gradle, and the value can be
// found in the NDK's source.properties file
var ndkSrcPropsPath = Path.join([context.ENV_ANDROID_NDK_ROOT, "source.properties"]);
if (FileSystem.exists(ndkSrcPropsPath))
{
try
{
var srcProps = File.getContent(ndkSrcPropsPath);
var lines = srcProps.split("\n");
for (line in lines)
{
var parts = ~/\s+=\s+/.split(StringTools.trim(line));
if (parts.length == 2 && parts[0] == "Pkg.Revision")
{
context.ANDROID_NDK_VERSION = parts[1];
}
}
}
catch (e:Dynamic)
{
}
}
if (Reflect.hasField(context, "KEY_STORE")) context.KEY_STORE = StringTools.replace(context.KEY_STORE, "\\", "\\\\");
if (Reflect.hasField(context, "KEY_STORE_ALIAS")) context.KEY_STORE_ALIAS = StringTools.replace(context.KEY_STORE_ALIAS, "\\", "\\\\");
if (Reflect.hasField(context, "KEY_STORE_PASSWORD")) context.KEY_STORE_PASSWORD = StringTools.replace(context.KEY_STORE_PASSWORD, "\\", "\\\\");