From a129b4924d61cd28fb31e8d901e48e9cf6e80e18 Mon Sep 17 00:00:00 2001 From: automaton82 Date: Sun, 14 Sep 2025 13:48:06 -0400 Subject: [PATCH 1/3] Add 16KB page size support for Google Play Store 2025 requirements Upgrade Android Gradle Plugin to 8.7.3, update target SDK to 35, add 16KB ELF alignment flags, and fix NDK r27 compilation issues across harfbuzz, SDL, and native libraries to ensure compliance with mandatory Play Store requirements effective November 2025. --- app/build.gradle | 7 +++++-- app/src/main/jni/Application.mk | 7 +++++-- .../SDL2/src/sensor/android/SDL_androidsensor.c | 2 +- .../main/jni/SDL2_ttf/external/harfbuzz/Android.mk | 4 +++- app/src/main/jni/cairo-1.14.0/Android.mk | 1 + app/src/main/jni/glib-2.77.0/Android.mk | 4 +++- app/src/main/jni/tuxpaint/Android.mk | 14 ++++++++++++++ app/src/main/jni/tuxpaint/src/i18n.c | 2 ++ app/src/main/jni/tuxpaint/src/tuxpaint.c | 5 +++-- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 11 files changed, 39 insertions(+), 11 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ecfb5c19d..8f4069b05 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,14 +9,17 @@ else { android { namespace 'org.tuxpaint' - compileSdkVersion 34 + compileSdkVersion 35 defaultConfig { minSdkVersion 21 - targetSdkVersion 34 + targetSdkVersion 35 externalNativeBuild { ndkBuild { arguments "APP_PLATFORM=android-21" + arguments "NDK_DEBUG=0" abiFilters 'arm64-v8a' + // Add 16KB page size alignment support - use ldFlags instead of cFlags + arguments "APP_LDFLAGS+=-Wl,-z,max-page-size=16384" } } } diff --git a/app/src/main/jni/Application.mk b/app/src/main/jni/Application.mk index 796404005..f7394a9f9 100644 --- a/app/src/main/jni/Application.mk +++ b/app/src/main/jni/Application.mk @@ -1,7 +1,10 @@ APP_ABI := arm64-v8a APP_PLATFORM := android-16 -APP_CFLAGS += -Wno-error=format-security +APP_CFLAGS += -Wno-error=format-security -Wno-error=cast-function-type-strict -Wno-error APP_STL := c++_shared -APP_CPPFLAGS += -fexceptions +APP_CPPFLAGS += -fexceptions -Wno-error=cast-function-type-strict -Wno-error +APP_CXXFLAGS += -Wno-error=cast-function-type-strict -Wno-error APP_ALLOW_MISSING_DEPS := true +# Add 16KB page size alignment support for Google Play Store 2025 requirements +APP_LDFLAGS += -Wl,-z,max-page-size=16384 diff --git a/app/src/main/jni/SDL2/src/sensor/android/SDL_androidsensor.c b/app/src/main/jni/SDL2/src/sensor/android/SDL_androidsensor.c index 1b1979184..29014f120 100644 --- a/app/src/main/jni/SDL2/src/sensor/android/SDL_androidsensor.c +++ b/app/src/main/jni/SDL2/src/sensor/android/SDL_androidsensor.c @@ -161,7 +161,7 @@ static void SDL_ANDROID_SensorUpdate(SDL_Sensor *sensor) ASensorEvent event; struct android_poll_source *source; - if (ALooper_pollAll(0, NULL, &events, (void **)&source) == LOOPER_ID_USER) { + if (ALooper_pollOnce(0, NULL, &events, (void **)&source) == LOOPER_ID_USER) { SDL_zero(event); while (ASensorEventQueue_getEvents(sensor->hwdata->eventqueue, &event, 1) > 0) { SDL_PrivateSensorUpdate(sensor, 0, event.data, SDL_arraysize(event.data)); diff --git a/app/src/main/jni/SDL2_ttf/external/harfbuzz/Android.mk b/app/src/main/jni/SDL2_ttf/external/harfbuzz/Android.mk index b9a04f720..0638ad456 100644 --- a/app/src/main/jni/SDL2_ttf/external/harfbuzz/Android.mk +++ b/app/src/main/jni/SDL2_ttf/external/harfbuzz/Android.mk @@ -61,7 +61,9 @@ LOCAL_C_INCLUDES = \ LOCAL_STATIC_LIBRARIES += freetype #LOCAL_CFLAGS += -DHB_NO_MT -DHAVE_OT -DHAVE_UCDN -fPIC -LOCAL_CFLAGS += -DHAVE_CONFIG_H -fPIC +LOCAL_CFLAGS += -DHAVE_CONFIG_H -fPIC -Wno-cast-function-type-strict -Wno-error -Wno-cast-function-type -w +LOCAL_CXXFLAGS += -Wno-cast-function-type-strict -Wno-error -Wno-cast-function-type -Wno-cast-function-type-strict -w +LOCAL_CPPFLAGS += -Wno-cast-function-type-strict -Wno-error -Wno-cast-function-type -w LOCAL_EXPORT_C_INCLUDES = $(LOCAL_PATH)/src/ diff --git a/app/src/main/jni/cairo-1.14.0/Android.mk b/app/src/main/jni/cairo-1.14.0/Android.mk index 6f313b931..c2bcd2bba 100644 --- a/app/src/main/jni/cairo-1.14.0/Android.mk +++ b/app/src/main/jni/cairo-1.14.0/Android.mk @@ -9,6 +9,7 @@ LOCAL_CFLAGS := \ -D_REENTRANT \ -DCAIRO_NO_MUTEX=1 \ -Wno-attributes \ + -Wno-error=int-conversion \ $(NULL) LOCAL_C_INCLUDES := \ diff --git a/app/src/main/jni/glib-2.77.0/Android.mk b/app/src/main/jni/glib-2.77.0/Android.mk index f2dff93f1..cee79414a 100644 --- a/app/src/main/jni/glib-2.77.0/Android.mk +++ b/app/src/main/jni/glib-2.77.0/Android.mk @@ -477,7 +477,9 @@ LOCAL_CFLAGS := \ -DGIO_COMPILATION \ -DGIO_MODULE_DIR=\"/mnt/sdcard/Android/data/org.tuxpaint/files/glib\" \ -DXDG_PREFIX=_gio_xdg \ - -marm \ + -UHAVE_STRERROR_R \ + -USTRERROR_R_CHAR_P \ + -Wno-error=int-conversion \ $(NULL) LOCAL_SHARED_LIBRARIES := \ diff --git a/app/src/main/jni/tuxpaint/Android.mk b/app/src/main/jni/tuxpaint/Android.mk index 93bbcb45a..d43597e6b 100644 --- a/app/src/main/jni/tuxpaint/Android.mk +++ b/app/src/main/jni/tuxpaint/Android.mk @@ -78,6 +78,13 @@ MY_DEFS := \ -DHAVE_STRCASESTR \ $(MY_NOSOUNDFLAG) $(MY_NOSVGFLAG) $(MY_NOPANGOFLAG) +LOCAL_C_INCLUDES := \ + $(LOCAL_PATH)/../SDL2/src/events \ + $(LOCAL_PATH)/../libimagequant \ + $(LOCAL_PATH)/src/mouse \ + $(LOCAL_PATH)/../fribidi-1.0.13 \ + $(NULL) + LOCAL_CFLAGS := \ $(MY_CFLAGS) \ $(MY_DEFS) @@ -86,6 +93,11 @@ LOCAL_LDLIBS := \ -lz -llog -lGLESv1_CM -lGLESv2 -landroid \ $(NULL) +# Add 16KB page size alignment support for Google Play Store 2025 requirements +LOCAL_LDFLAGS := \ + -Wl,-z,max-page-size=16384 \ + $(NULL) + LOCAL_SHARED_LIBRARIES := SDL2 SDL2_image SDL2_mixer SDL2_ttf SDL2_Pango tuxpaint_intl tuxpaint_fribidi tuxpaint_png tuxpaint_rsvg tuxpaint_cairo tp_android_assets_fopen libimagequant SDL2_gfx tuxpaint_pango tuxpaint_fontconfig tuxpaint_glib tuxpaint_xml2 include $(BUILD_SHARED_LIBRARY) @@ -98,6 +110,8 @@ $(foreach _magic, $(MAGIC_NAMES),\ $(eval LOCAL_MODULE := $(_magic))\ $(eval LOCAL_C_INCLUDES := $(LOCAL_PATH)/src $(LOCAL_PATH)/../SDL2_gfx-1.0.4/)\ $(eval MAGIC_CFLAGS:=-g3 -O2 -fno-common -W -Wstrict-prototypes -Wmissing-prototypes -Wall)\ + $(eval LOCAL_CFLAGS := $(MAGIC_CFLAGS))\ + $(eval LOCAL_LDFLAGS := -Wl,-z,max-page-size=16384)\ $(eval LOCAL_SRC_FILES := magic/src/$(_magic).c)\ $(eval LOCAL_SHARED_LIBRARIES := SDL2 SDL2_image SDL2_mixer SDL2_ttf tuxpaint_intl SDL2_gfx)\ $(eval include $(BUILD_SHARED_LIBRARY))\ diff --git a/app/src/main/jni/tuxpaint/src/i18n.c b/app/src/main/jni/tuxpaint/src/i18n.c index f78311739..79eb8f3c8 100644 --- a/app/src/main/jni/tuxpaint/src/i18n.c +++ b/app/src/main/jni/tuxpaint/src/i18n.c @@ -31,6 +31,8 @@ #include #include #include +#include "SDL2/SDL.h" +#include "../../../SDL2/src/core/android/SDL_android.h" #include "platform.h" #include "i18n.h" #include "debug.h" diff --git a/app/src/main/jni/tuxpaint/src/tuxpaint.c b/app/src/main/jni/tuxpaint/src/tuxpaint.c index 1740fdcfe..3c0aa6662 100644 --- a/app/src/main/jni/tuxpaint/src/tuxpaint.c +++ b/app/src/main/jni/tuxpaint/src/tuxpaint.c @@ -409,6 +409,7 @@ int iswprint(wchar_t wc) #include #include "SDL2/SDL.h" +#include "SDL_mouse_c.h" #include "SDL2/SDL_thread.h" #if defined(__MACOS__) @@ -31871,7 +31872,7 @@ static void convert_motion_to_wheel(SDL_Event event) { while (motion_dy - high > 0) { - SDL_SendMouseWheel(NULL, event.motion.which, 0, 1); + SDL_SendMouseWheel(NULL, event.motion.which, 0.0f, 1.0f, SDL_MOUSEWHEEL_NORMAL); motion_dy -= high; } } @@ -31879,7 +31880,7 @@ static void convert_motion_to_wheel(SDL_Event event) { while (motion_dy + high < 0) { - SDL_SendMouseWheel(NULL, event.motion.which, 0, -1); + SDL_SendMouseWheel(NULL, event.motion.which, 0.0f, -1.0f, SDL_MOUSEWHEEL_NORMAL); motion_dy += high; } } diff --git a/build.gradle b/build.gradle index 2f2380b05..ed2299cb0 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:8.2.1' + classpath 'com.android.tools.build:gradle:8.7.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 18327d574..db7a5fb47 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Mon Nov 13 22:58:21 EST 2023 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.9-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 606c2e11c077340e5d5fc3060da9a01e62e8f431 Mon Sep 17 00:00:00 2001 From: automaton82 Date: Sun, 14 Sep 2025 14:13:22 -0400 Subject: [PATCH 2/3] Remove NDK_DEBUG argument from ndkBuild configuration --- app/build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 8f4069b05..1f06908d2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,7 +16,6 @@ android { externalNativeBuild { ndkBuild { arguments "APP_PLATFORM=android-21" - arguments "NDK_DEBUG=0" abiFilters 'arm64-v8a' // Add 16KB page size alignment support - use ldFlags instead of cFlags arguments "APP_LDFLAGS+=-Wl,-z,max-page-size=16384" From 3fe8e07d57b88234be32c3d3fe85059dc47efc4f Mon Sep 17 00:00:00 2001 From: automaton82 Date: Sun, 14 Sep 2025 19:27:33 -0400 Subject: [PATCH 3/3] Addressing comments from Pere --- app/src/main/jni/tuxpaint/src/i18n.c | 3 +-- app/src/main/jni/tuxpaint/src/tuxpaint.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/jni/tuxpaint/src/i18n.c b/app/src/main/jni/tuxpaint/src/i18n.c index 79eb8f3c8..e38d102d5 100644 --- a/app/src/main/jni/tuxpaint/src/i18n.c +++ b/app/src/main/jni/tuxpaint/src/i18n.c @@ -31,8 +31,6 @@ #include #include #include -#include "SDL2/SDL.h" -#include "../../../SDL2/src/core/android/SDL_android.h" #include "platform.h" #include "i18n.h" #include "debug.h" @@ -54,6 +52,7 @@ #ifdef __ANDROID__ #include "SDL2/SDL.h" +#include "../../../SDL2/src/core/android/SDL_android.h" #include "jni.h" // since setlocale on the Android is not supported well, // setlocale cannot get current default locale of the device. diff --git a/app/src/main/jni/tuxpaint/src/tuxpaint.c b/app/src/main/jni/tuxpaint/src/tuxpaint.c index 3c0aa6662..dbb5e1f41 100644 --- a/app/src/main/jni/tuxpaint/src/tuxpaint.c +++ b/app/src/main/jni/tuxpaint/src/tuxpaint.c @@ -358,6 +358,7 @@ extern status_t haiku_trash(const char *f); #define AUTOSAVE_GOING_BACKGROUND #include "android_print.h" #include "android_assets.h" +#include "SDL_mouse_c.h" int entered_background = 0; #else @@ -409,7 +410,6 @@ int iswprint(wchar_t wc) #include #include "SDL2/SDL.h" -#include "SDL_mouse_c.h" #include "SDL2/SDL_thread.h" #if defined(__MACOS__)