Updated Android build tools version, which bumped minimum deployment target to API 14 Also added native code to the Android gradle project, which allows using gradle or Android Studio to build the entire SDL application without a separate ndk-build step.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
diff --git a/android-project/app/build.gradle b/android-project/app/build.gradle
index b670a69..ed2dc7a 100644
--- a/android-project/app/build.gradle
+++ b/android-project/app/build.gradle
@@ -1,14 +1,19 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 25
- buildToolsVersion "25.0.1"
+ compileSdkVersion 16
+ buildToolsVersion "26.0.1"
defaultConfig {
applicationId "org.libsdl.app"
- minSdkVersion 10
+ minSdkVersion 14
targetSdkVersion 16
versionCode 1
versionName "1.0"
+ externalNativeBuild {
+ ndkBuild {
+ arguments "APP_PLATFORM=android-14"
+ }
+ }
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
@@ -19,7 +24,11 @@ android {
}
sourceSets.main {
jniLibs.srcDir 'libs'
- jni.srcDirs = [] //disable automatic ndk-build call
+ }
+ externalNativeBuild {
+ ndkBuild {
+ path 'jni/Android.mk'
+ }
}
lintOptions {
abortOnError false
@@ -27,7 +36,7 @@ android {
}
dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
diff --git a/android-project/app/jni/Application.mk b/android-project/app/jni/Application.mk
index 70bcf0c..b6dc195 100644
--- a/android-project/app/jni/Application.mk
+++ b/android-project/app/jni/Application.mk
@@ -6,4 +6,4 @@
APP_ABI := all
# Min SDK level
-APP_PLATFORM=android-10
+APP_PLATFORM=android-14
diff --git a/build-scripts/androidbuild.sh b/build-scripts/androidbuild.sh
index 916831c..8145781 100755
--- a/build-scripts/androidbuild.sh
+++ b/build-scripts/androidbuild.sh
@@ -25,12 +25,9 @@ if [ -z "$1" ] || [ -z "$SOURCES" ]; then
echo "Usage: androidbuild.sh com.yourcompany.yourapp < sources.list"
echo "Usage: androidbuild.sh com.yourcompany.yourapp source1.c source2.c ...sourceN.c"
echo "To copy SDL source instead of symlinking: COPYSOURCE=1 androidbuild.sh ... "
- echo "You can pass additional arguments to ndk-build with the NDKARGS variable: NDKARGS=\"-s\" androidbuild.sh ..."
exit 1
fi
-
-
SDLPATH="$( cd "$(dirname "$0")/.." ; pwd -P )"
if [ -z "$ANDROID_HOME" ];then
@@ -38,34 +35,11 @@ if [ -z "$ANDROID_HOME" ];then
exit 1
fi
-NDKBUILD=`which ndk-build`
-if [ -z "$NDKBUILD" ];then
- echo "Could not find the ndk-build utility, install Android's NDK and add it to the path"
+if [ ! -d "$ANDROID_HOME/ndk-bundle" -a -z "$ANDROID_NDK_HOME" ]; then
+ echo "Please set the ANDROID_NDK_HOME directory to the path of the Android NDK"
exit 1
fi
-ANDROID="$ANDROID_HOME/tools/android"
-if [ ! -f "$ANDROID" ]; then
- ANDROID=`which android`
-fi
-if [ -z "$ANDROID" ];then
- echo "Could not find the android utility, install Android's SDK and add it to the path"
- exit 1
-fi
-
-NCPUS="1"
-case "$OSTYPE" in
- darwin*)
- NCPU=`sysctl -n hw.ncpu`
- ;;
- linux*)
- if [ -n `which nproc` ]; then
- NCPUS=`nproc`
- fi
- ;;
- *);;
-esac
-
APP="$1"
APPARR=(${APP//./ })
BUILDPATH="$SDLPATH/build/$APP"
@@ -121,24 +95,6 @@ public class $ACTIVITY extends SDLActivity
__EOF__
# Update project and build
-cd $BUILDPATH
-pushd $BUILDPATH/app/jni
-$NDKBUILD -j $NCPUS $NDKARGS
-popd
-
-# Start gradle build
-$BUILDPATH/gradlew build
-
-cd $CURDIR
-
-APK="$BUILDPATH/app/build/outputs/apk/app-debug.apk"
-
-if [ -f "$APK" ]; then
- echo "Your APK is ready at $APK"
- echo "To install to your device: "
- echo "$ANDROID_HOME/platform-tools/adb install -r $APK"
- exit 0
-fi
-
-echo "There was an error building the APK"
-exit 1
+echo "To build and install to a device for testing, run the following:"
+echo "cd $BUILDPATH"
+echo "./gradlew installDebug"
diff --git a/docs/README-android.md b/docs/README-android.md
index 1bf4dfd..87cff3f 100644
--- a/docs/README-android.md
+++ b/docs/README-android.md
@@ -14,11 +14,10 @@ The rest of this README covers the traditional style build process.
Android SDK (version 16 or later)
https://developer.android.com/sdk/index.html
-Android NDK r7 or later
+Android NDK r10e or later
https://developer.android.com/tools/sdk/ndk/index.html
-Minimum API level supported by SDL: 10 (Android 2.3.3)
-Joystick support is available for API level >= 12 devices.
+Minimum API level supported by SDL: 14 (Android 4.0.1)
================================================================================
@@ -393,22 +392,13 @@ https://developer.nvidia.com/tegra-graphics-debugger
================================================================================
- Why is API level 10 the minimum required?
+ Why is API level 14 the minimum required?
================================================================================
-API level 10 is the minimum required level at runtime (that is, on the device)
-because SDL requires some functionality for running not
-available on older devices. Since the incorporation of joystick support into SDL,
-the minimum SDK required to *build* SDL is version 16. Devices running API levels
-10-11 are still supported, only with the joystick functionality disabled.
-
-Support for native OpenGL ES and ES2 applications was introduced in the NDK for
-API level 4 and 8. EGL was made a stable API in the NDK for API level 9, which
-has since then been obsoleted, with the recommendation to developers to bump the
-required API level to 10.
+The latest NDK toolchain doesn't support targeting earlier than API level 14.
As of this writing, according to https://developer.android.com/about/dashboards/index.html
-about 90% of the Android devices accessing Google Play support API level 10 or
-higher (March 2013).
+about 99% of the Android devices accessing Google Play support API level 14 or
+higher (October 2017).
================================================================================