mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 02:05:35 +00:00
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.
This commit is contained in:
parent
76cdce440c
commit
edf0fae139
|
@ -1,14 +1,19 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 25
|
compileSdkVersion 16
|
||||||
buildToolsVersion "25.0.1"
|
buildToolsVersion "26.0.1"
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "org.libsdl.app"
|
applicationId "org.libsdl.app"
|
||||||
minSdkVersion 10
|
minSdkVersion 14
|
||||||
targetSdkVersion 16
|
targetSdkVersion 16
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
|
externalNativeBuild {
|
||||||
|
ndkBuild {
|
||||||
|
arguments "APP_PLATFORM=android-14"
|
||||||
|
}
|
||||||
|
}
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
@ -19,7 +24,11 @@ android {
|
||||||
}
|
}
|
||||||
sourceSets.main {
|
sourceSets.main {
|
||||||
jniLibs.srcDir 'libs'
|
jniLibs.srcDir 'libs'
|
||||||
jni.srcDirs = [] //disable automatic ndk-build call
|
}
|
||||||
|
externalNativeBuild {
|
||||||
|
ndkBuild {
|
||||||
|
path 'jni/Android.mk'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
lintOptions {
|
lintOptions {
|
||||||
abortOnError false
|
abortOnError false
|
||||||
|
@ -27,7 +36,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
|
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
|
||||||
exclude group: 'com.android.support', module: 'support-annotations'
|
exclude group: 'com.android.support', module: 'support-annotations'
|
||||||
})
|
})
|
||||||
|
|
|
@ -6,4 +6,4 @@
|
||||||
APP_ABI := all
|
APP_ABI := all
|
||||||
|
|
||||||
# Min SDK level
|
# Min SDK level
|
||||||
APP_PLATFORM=android-10
|
APP_PLATFORM=android-14
|
||||||
|
|
|
@ -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 < sources.list"
|
||||||
echo "Usage: androidbuild.sh com.yourcompany.yourapp source1.c source2.c ...sourceN.c"
|
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 "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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SDLPATH="$( cd "$(dirname "$0")/.." ; pwd -P )"
|
SDLPATH="$( cd "$(dirname "$0")/.." ; pwd -P )"
|
||||||
|
|
||||||
if [ -z "$ANDROID_HOME" ];then
|
if [ -z "$ANDROID_HOME" ];then
|
||||||
|
@ -38,34 +35,11 @@ if [ -z "$ANDROID_HOME" ];then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
NDKBUILD=`which ndk-build`
|
if [ ! -d "$ANDROID_HOME/ndk-bundle" -a -z "$ANDROID_NDK_HOME" ]; then
|
||||||
if [ -z "$NDKBUILD" ];then
|
echo "Please set the ANDROID_NDK_HOME directory to the path of the Android NDK"
|
||||||
echo "Could not find the ndk-build utility, install Android's NDK and add it to the path"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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"
|
APP="$1"
|
||||||
APPARR=(${APP//./ })
|
APPARR=(${APP//./ })
|
||||||
BUILDPATH="$SDLPATH/build/$APP"
|
BUILDPATH="$SDLPATH/build/$APP"
|
||||||
|
@ -121,24 +95,6 @@ public class $ACTIVITY extends SDLActivity
|
||||||
__EOF__
|
__EOF__
|
||||||
|
|
||||||
# Update project and build
|
# Update project and build
|
||||||
cd $BUILDPATH
|
echo "To build and install to a device for testing, run the following:"
|
||||||
pushd $BUILDPATH/app/jni
|
echo "cd $BUILDPATH"
|
||||||
$NDKBUILD -j $NCPUS $NDKARGS
|
echo "./gradlew installDebug"
|
||||||
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
|
|
||||||
|
|
|
@ -14,11 +14,10 @@ The rest of this README covers the traditional style build process.
|
||||||
Android SDK (version 16 or later)
|
Android SDK (version 16 or later)
|
||||||
https://developer.android.com/sdk/index.html
|
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
|
https://developer.android.com/tools/sdk/ndk/index.html
|
||||||
|
|
||||||
Minimum API level supported by SDL: 10 (Android 2.3.3)
|
Minimum API level supported by SDL: 14 (Android 4.0.1)
|
||||||
Joystick support is available for API level >= 12 devices.
|
|
||||||
|
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
|
@ -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)
|
The latest NDK toolchain doesn't support targeting earlier than API level 14.
|
||||||
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.
|
|
||||||
As of this writing, according to https://developer.android.com/about/dashboards/index.html
|
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
|
about 99% of the Android devices accessing Google Play support API level 14 or
|
||||||
higher (March 2013).
|
higher (October 2017).
|
||||||
|
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
Loading…
Reference in a new issue