diff --git a/.gitignore b/.gitignore index 8adc7b786c6..97cf4e62555 100644 --- a/.gitignore +++ b/.gitignore @@ -89,6 +89,7 @@ local.properties *.iml .gradletasknamecache project.properties +platform/android/java/build/ platform/android/java/*/.cxx/ platform/android/java/*/build/ platform/android/java/*/libs/ diff --git a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs index e969f31c8bc..b4992d0bf48 100644 --- a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs +++ b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs @@ -26,6 +26,10 @@ namespace GodotTools.ProjectEditor var mainGroup = root.AddPropertyGroup(); mainGroup.AddProperty("TargetFramework", GodotMinimumRequiredTfm); + // Non-gradle builds require .NET 9 to match the jar libraries included in the export template. + var net9 = mainGroup.AddProperty("TargetFramework", "net9.0"); + net9.Condition = " '$(GodotTargetPlatform)' == 'android' "; + mainGroup.AddProperty("EnableDynamicLoading", "true"); string sanitizedName = IdentifierUtils.SanitizeQualifiedIdentifier(name, allowEmptyIdentifiers: true); diff --git a/modules/mono/thirdparty/libSystem.Security.Cryptography.Native.Android.jar b/modules/mono/thirdparty/libSystem.Security.Cryptography.Native.Android.jar index 73660308818..7dd662be195 100755 Binary files a/modules/mono/thirdparty/libSystem.Security.Cryptography.Native.Android.jar and b/modules/mono/thirdparty/libSystem.Security.Cryptography.Native.Android.jar differ diff --git a/modules/mono/thirdparty/libSystem.Security.Cryptography.Native.Android.jar.source.txt b/modules/mono/thirdparty/libSystem.Security.Cryptography.Native.Android.jar.source.txt new file mode 100644 index 00000000000..188b63e09dd --- /dev/null +++ b/modules/mono/thirdparty/libSystem.Security.Cryptography.Native.Android.jar.source.txt @@ -0,0 +1 @@ +https://www.nuget.org/packages/Microsoft.NETCore.App.Runtime.Mono.android-arm64/9.0.4 diff --git a/platform/android/SCsub b/platform/android/SCsub index 2260a84a760..c859373eaa0 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -1,6 +1,7 @@ #!/usr/bin/env python from misc.utility.scons_hints import * +import platform import subprocess import sys @@ -50,18 +51,34 @@ lib = env_android.add_shared_library("#bin/libgodot", [android_objects], SHLIBSU env.Depends(lib, thirdparty_obj) lib_arch_dir = "" +triple_target_dir = "" if env["arch"] == "arm32": lib_arch_dir = "armeabi-v7a" + triple_target_dir = "arm-linux-androideabi" elif env["arch"] == "arm64": lib_arch_dir = "arm64-v8a" + triple_target_dir = "aarch64-linux-android" elif env["arch"] == "x86_32": lib_arch_dir = "x86" + triple_target_dir = "i686-linux-android" elif env["arch"] == "x86_64": lib_arch_dir = "x86_64" + triple_target_dir = "x86_64-linux-android" else: print_warning("Architecture not suitable for embedding into APK; keeping .so at \\bin") -if lib_arch_dir != "": +host_subpath = "" +if sys.platform.startswith("linux"): + host_subpath = "linux-x86_64" +elif sys.platform.startswith("darwin"): + host_subpath = "darwin-x86_64" +elif sys.platform.startswith("win"): + if platform.machine().endswith("64"): + host_subpath = "windows-x86_64" + else: + host_subpath = "windows" + +if lib_arch_dir != "" and host_subpath != "": if env.dev_build: lib_type_dir = "dev" elif env.debug_features: @@ -82,9 +99,7 @@ if lib_arch_dir != "": out_dir + "/libgodot_android.so", "#bin/libgodot" + env["SHLIBSUFFIX"], Move("$TARGET", "$SOURCE") ) - stl_lib_path = ( - str(env["ANDROID_NDK_ROOT"]) + "/sources/cxx-stl/llvm-libc++/libs/" + lib_arch_dir + "/libc++_shared.so" - ) + stl_lib_path = f"{env['ANDROID_NDK_ROOT']}/toolchains/llvm/prebuilt/{host_subpath}/sysroot/usr/lib/{triple_target_dir}/libc++_shared.so" env_android.Command(out_dir + "/libc++_shared.so", stl_lib_path, Copy("$TARGET", "$SOURCE")) def generate_apk(target, source, env): @@ -99,10 +114,11 @@ if lib_arch_dir != "": else: gradle_process = ["./gradlew"] - gradle_process += [ - "generateGodotEditor" if env["target"] == "editor" else "generateGodotTemplates", - "--quiet", - ] + if env["target"] == "editor": + gradle_process += ["generateGodotEditor", "generateGodotHorizonOSEditor", "generateGodotPicoOSEditor"] + else: + gradle_process += ["generateGodotTemplates"] + gradle_process += ["--quiet"] if env["debug_symbols"]: gradle_process += ["-PdoNotStrip=true"] diff --git a/platform/android/detect.py b/platform/android/detect.py index cac7c3f48d4..013b66a73b7 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -64,7 +64,7 @@ def get_android_ndk_root(env: "SConsEnvironment"): # This is kept in sync with the value in 'platform/android/java/app/config.gradle'. def get_ndk_version(): - return "23.2.8568313" + return "28.1.13356709" # This is kept in sync with the value in 'platform/android/java/app/config.gradle'. diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp index 4a3b1fc0984..77466612a47 100644 --- a/platform/android/export/export_plugin.cpp +++ b/platform/android/export/export_plugin.cpp @@ -283,11 +283,11 @@ static const int EXPORT_FORMAT_APK = 0; static const int EXPORT_FORMAT_AAB = 1; static const char *APK_ASSETS_DIRECTORY = "assets"; -static const char *AAB_ASSETS_DIRECTORY = "assetPacks/installTime/src/main/assets"; +static const char *AAB_ASSETS_DIRECTORY = "assetPackInstallTime/src/main/assets"; static const int OPENGL_MIN_SDK_VERSION = 21; // Should match the value in 'platform/android/java/app/config.gradle#minSdk' static const int VULKAN_MIN_SDK_VERSION = 24; -static const int DEFAULT_TARGET_SDK_VERSION = 34; // Should match the value in 'platform/android/java/app/config.gradle#targetSdk' +static const int DEFAULT_TARGET_SDK_VERSION = 35; // Should match the value in 'platform/android/java/app/config.gradle#targetSdk' #ifndef ANDROID_ENABLED void EditorExportPlatformAndroid::_check_for_changes_poll_thread(void *ud) { @@ -791,7 +791,7 @@ Error EditorExportPlatformAndroid::save_apk_so(void *p_userdata, const SharedObj String abi = abis[abi_index].abi; String dst_path = String("lib").path_join(abi).path_join(p_so.path.get_file()); Vector array = FileAccess::get_file_as_bytes(p_so.path); - Error store_err = store_in_apk(ed, dst_path, array); + Error store_err = store_in_apk(ed, dst_path, array, Z_NO_COMPRESSION); ERR_FAIL_COND_V_MSG(store_err, store_err, "Cannot store in apk file '" + dst_path + "'."); } } @@ -2542,6 +2542,7 @@ bool _validate_dotnet_tfm(const String &required_tfm, String &r_error) { List args; args.push_back("build"); args.push_back(project_path); + args.push_back("/p:GodotTargetPlatform=android"); args.push_back("--getProperty:TargetFramework"); int exitcode; @@ -2576,9 +2577,9 @@ bool EditorExportPlatformAndroid::has_valid_export_configuration(const Ref return Boolean.parseBoolean(legacyPackagingFlag) } - // Default behavior for minSdk >= 23 + if (getExportMinSdkVersion() <= 29) { + // Use legacy packaging for compatibility with device running api <= 29. + // See https://github.com/godotengine/godot/issues/108842 for reference. + return true + } + + // Default behavior for minSdk > 29. return false } diff --git a/platform/android/java/app/settings.gradle b/platform/android/java/app/settings.gradle index e758d4e99a7..63183d2d5d0 100644 --- a/platform/android/java/app/settings.gradle +++ b/platform/android/java/app/settings.gradle @@ -15,4 +15,4 @@ pluginManagement { } } -include ':assetPacks:installTime' +include ':assetPackInstallTime' diff --git a/platform/android/java/editor/build.gradle b/platform/android/java/editor/build.gradle index bfc123c8cd8..d0fc08e47fa 100644 --- a/platform/android/java/editor/build.gradle +++ b/platform/android/java/editor/build.gradle @@ -184,7 +184,7 @@ dependencies { implementation "androidx.window:window:1.3.0" implementation "androidx.core:core-splashscreen:$versions.splashscreenVersion" - implementation "androidx.constraintlayout:constraintlayout:2.1.4" + implementation "androidx.constraintlayout:constraintlayout:2.2.1" implementation "org.bouncycastle:bcprov-jdk15to18:1.78" // Meta dependencies diff --git a/platform/android/java/gradle/wrapper/gradle-wrapper.properties b/platform/android/java/gradle/wrapper/gradle-wrapper.properties index 471fefaf905..642629c8b84 100644 --- a/platform/android/java/gradle/wrapper/gradle-wrapper.properties +++ b/platform/android/java/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Wed Jan 17 12:08:26 PST 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/platform/android/java/nativeSrcsConfigs/CMakeLists.txt b/platform/android/java/nativeSrcsConfigs/CMakeLists.txt index a5ecafeb09d..1584c6fd5ce 100644 --- a/platform/android/java/nativeSrcsConfigs/CMakeLists.txt +++ b/platform/android/java/nativeSrcsConfigs/CMakeLists.txt @@ -1,5 +1,5 @@ # Non functional cmake build file used to provide Android Studio editor support to the project. -cmake_minimum_required(VERSION 3.6) +cmake_minimum_required(VERSION 3.10) project(godot) set(CMAKE_CXX_STANDARD 14) diff --git a/platform/android/java/scripts/publish-module.gradle b/platform/android/java/scripts/publish-module.gradle index 32b749e493d..c2c905a6e40 100644 --- a/platform/android/java/scripts/publish-module.gradle +++ b/platform/android/java/scripts/publish-module.gradle @@ -43,7 +43,11 @@ afterEvaluate { name = 'Rémi Verschelde' email = 'rverschelde@gmail.com' } - // Add all other devs here... + developer { + id = 'godotengine' + name = 'Godot Engine contributors' + email = 'contact@godotengine.org' + } } // Version control info - if you're using GitHub, follow the diff --git a/platform/android/java/settings.gradle b/platform/android/java/settings.gradle index 41418a4a45e..e2ed6f0a899 100644 --- a/platform/android/java/settings.gradle +++ b/platform/android/java/settings.gradle @@ -25,5 +25,5 @@ include ':lib' include ':nativeSrcsConfigs' include ':editor' -include ':assetPacks:installTime' -project(':assetPacks:installTime').projectDir = file("app/assetPacks/installTime") +include ':assetPackInstallTime' +project(':assetPackInstallTime').projectDir = file("app/assetPackInstallTime")