SDL/src
Sam Lantinga 5fe69a18f5 Fixed bug 2758 - Android issues with NDK r10c and API-21
Sylvain

After a long time, I found out more clearly what was going wrong.

The native libraries should be built with a "APP_PLATFORM" as low as possible.
Ideally, APP_PLATFORM should be equals to the minSdkVersion of the AndroidManifest.xml
So that the application never runs on a lower APP_PLATFORM than it has been built for.

An additional good patch would be to write explicitly in "jni/Application.mk": APP_PLATFORM=android-10

(If no APP_PLATFORM is set, the "targetSdkVersion" of the AndroidManifest.xml is applied as an APP_PLATFORM to the native libraries. And currently, this is bad, because targetSdkVersion is 12, whereas minSdkLevel is 10.
And in fact, there is a warning from ndk: "Android NDK: WARNING: APP_PLATFORM android-12 is larger than android:minSdkVersion 10 in ./AndroidManifest.xml".)


to precise what happened in the initial reported test-case:
Let say the "c" code contains a call to "srand()".

with APP_PLATFORM=android-21, libSDL2.so contains a undef reference to "srand()".
with APP_PLATFORM=android-10, libSDL2.so contains a undef reference to "srand48()".

but srand() is missing on devices with APP_PLATFORM=android-10 (it was in fact replaced by srand48()).
So, if you build for android-21 (where srand() is available), you will really have a call to "srand()" and it will fail on android-10.
That was the issue. The path tried to fix this by in fact always calling srand48().


SDL patches that were applied are beneficial anyway, there are implicitly allowing they backward compatibility of using android-21 on a android-10 platform.
It can be helpful in case you want to target a higher APP_PLATFORM than minSdkVersion to have potentially access to more functions.
Eg you want to have access to GLES3 functions (or other) of "android-21". But, if dlopen() fails (on android-10), you do a fall-back to GLES2.
2016-10-14 06:57:55 -07:00
..
atomic Updated copyright to 2016 2016-01-02 10:10:34 -08:00
audio Work-around for a hang when USB devices are unplugged, contributed by James Zipperer 2016-10-12 22:25:19 -07:00
core Fixed building with cmake when fcitx isn't installed 2016-10-14 01:04:21 -07:00
cpuinfo Updated copyright to 2016 2016-01-02 10:10:34 -08:00
dynapi Implemented SDL_GetHintBoolean() to make it easier to check boolean hints 2016-10-07 23:40:44 -07:00
events Linux: Fixed mixed up scancodes. 2016-10-09 20:31:04 +02:00
file Updated copyright to 2016 2016-01-02 10:10:34 -08:00
filesystem Fixed compiling if filesystem is disabled (thanks, Elias!). 2016-08-30 21:14:13 +02:00
haptic Implemented SDL_GetHintBoolean() to make it easier to check boolean hints 2016-10-07 23:40:44 -07:00
joystick Added support for the PS4 Slim controller, model CUH-ZCT2U 2016-10-13 02:19:23 -07:00
libm Updated copyright to 2016 2016-01-02 10:10:34 -08:00
loadso Enable SDL_LoadObject on iOS 8+ and tvOS. 2016-09-25 15:02:06 -03:00
main Backed out change 92dc590a7116 which was: Fixed bug 3320 - SDL_windows_main.c defines both console application entry points 2016-10-12 19:50:16 -07:00
power Initial Apple TV / tvOS support. 2016-09-13 22:18:06 -03:00
render Fixed divide by zero if setting integer scale without setting logical width and height 2016-10-14 00:51:57 -07:00
stdlib Made #if defined(X) consistent 2016-10-10 02:58:29 -07:00
test We should be using a string constant for the strftime format string 2016-10-01 10:38:15 -07:00
thread Fixed bug 2758 - Android issues with NDK r10c and API-21 2016-10-14 06:57:55 -07:00
timer threads: Move SDL's own thread creation to a new internal API. 2016-04-12 16:45:10 -04:00
video Fixed bug 3328 - Race condition in Wayland_VideoInit 2016-10-13 04:54:43 -07:00
SDL_assert_c.h Updated copyright to 2016 2016-01-02 10:10:34 -08:00
SDL_assert.c Updated copyright to 2016 2016-01-02 10:10:34 -08:00
SDL_error_c.h Updated copyright to 2016 2016-01-02 10:10:34 -08:00
SDL_error.c Only use GCC pragmas when we're building with GCC 2016-10-01 11:22:39 -07:00
SDL_hints.c Implemented SDL_GetHintBoolean() to make it easier to check boolean hints 2016-10-07 23:40:44 -07:00
SDL_internal.h Updated copyright to 2016 2016-01-02 10:10:34 -08:00
SDL_log.c Fixed bug 3323 - SDL_LogOutput prints message twice on Windows when linked with libc 2016-10-01 12:28:05 -07:00
SDL.c Initial Apple TV / tvOS support. 2016-09-13 22:18:06 -03:00