Updated Android project files and documentation
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
diff --git a/android-project/app/build.gradle b/android-project/app/build.gradle
index 0e361bc..3900943 100644
--- a/android-project/app/build.gradle
+++ b/android-project/app/build.gradle
@@ -9,7 +9,6 @@ else {
android {
compileSdkVersion 26
- buildToolsVersion "26.0.1"
defaultConfig {
if (buildAsApplication) {
applicationId "org.libsdl.app"
@@ -21,10 +20,9 @@ android {
externalNativeBuild {
ndkBuild {
arguments "APP_PLATFORM=android-14"
- abiFilters 'armeabi-v7a', 'x86'
+ abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
}
}
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
@@ -61,9 +59,5 @@ android {
}
dependencies {
- 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'
- })
- testCompile 'junit:junit:4.12'
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
}
diff --git a/android-project/app/jni/Application.mk b/android-project/app/jni/Application.mk
index 246136d..15b2a73 100644
--- a/android-project/app/jni/Application.mk
+++ b/android-project/app/jni/Application.mk
@@ -1,7 +1,8 @@
# Uncomment this if you're using STL in your project
-# See CPLUSPLUS-SUPPORT.html in the NDK documentation for more information
-# APP_STL := stlport_static
+# You can find more information here:
+# https://developer.android.com/ndk/guides/cpp-support
+# APP_STL := c++_shared
APP_ABI := armeabi-v7a arm64-v8a x86 x86_64
diff --git a/android-project/app/src/main/AndroidManifest.xml b/android-project/app/src/main/AndroidManifest.xml
index 0099eb5..25730cf 100644
--- a/android-project/app/src/main/AndroidManifest.xml
+++ b/android-project/app/src/main/AndroidManifest.xml
@@ -8,9 +8,6 @@
android:versionName="1.0"
android:installLocation="auto">
- <!-- Android 4.0.1 -->
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="16" />
-
<!-- OpenGL ES 2.0 -->
<uses-feature android:glEsVersion="0x00020000" />
diff --git a/android-project/build.gradle b/android-project/build.gradle
index c2eea8e..f6f90b2 100644
--- a/android-project/build.gradle
+++ b/android-project/build.gradle
@@ -3,9 +3,10 @@
buildscript {
repositories {
jcenter()
+ google()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.3'
+ classpath 'com.android.tools.build:gradle:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@@ -15,6 +16,7 @@ buildscript {
allprojects {
repositories {
jcenter()
+ google()
}
}
diff --git a/android-project/gradle/wrapper/gradle-wrapper.properties b/android-project/gradle/wrapper/gradle-wrapper.properties
index 6035d0e..f9b3be2 100644
--- a/android-project/gradle/wrapper/gradle-wrapper.properties
+++ b/android-project/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
diff --git a/docs/README-android.md b/docs/README-android.md
index 9af88be..0aa90e7 100644
--- a/docs/README-android.md
+++ b/docs/README-android.md
@@ -77,18 +77,16 @@ For more complex projects, follow these instructions:
and rename it to the name of your project.
2. Move or symlink this SDL directory into the "<project>/app/jni" directory
3. Edit "<project>/app/jni/src/Android.mk" to include your source files
-4. Run 'ndk-build' (a script provided by the NDK). This compiles the C source
-If you want to use Android Studio (recommended), skip to the Android Studio section below.
+4a. If you want to use Android Studio, simply open your <project> directory and start building.
-5. Run './gradlew installDebug' in the project directory. This compiles the .java, creates an .apk with the native code embedded, and installs it on any connected Android device
+4b. If you want to build manually, run './gradlew installDebug' in the project directory. This compiles the .java, creates an .apk with the native code embedded, and installs it on any connected Android device
Here's an explanation of the files in the Android project, so you can customize them:
android-project/app
build.gradle - build info including the application version and SDK
- src/main/AndroidManifest.xml - package manifest. Among others, it contains the class name
- of the main Activity and the package name of the application.
+ src/main/AndroidManifest.xml - package manifest. Among others, it contains the class name of the main Activity and the package name of the application.
jni/ - directory holding native code
jni/Application.mk - Application JNI settings, including target platform and STL library
jni/Android.mk - Android makefile that can call recursively the Android.mk files in all subdirectories
@@ -216,26 +214,10 @@ detach it.
You can use STL in your project by creating an Application.mk file in the jni
folder and adding the following line:
- APP_STL := stlport_static
+ APP_STL := c++_shared
-For more information check out CPLUSPLUS-SUPPORT.html in the NDK documentation.
-
-
-================================================================================
- Additional documentation
-================================================================================
-
-The documentation in the NDK docs directory is very helpful in understanding the
-build process and how to work with native code on the Android platform.
-
-The best place to start is with docs/OVERVIEW.TXT
-
-
-================================================================================
- Using Android Studio
-================================================================================
-
-You can open your project directory with Android Studio and run it normally.
+For more information go here:
+ https://developer.android.com/ndk/guides/cpp-support
================================================================================
@@ -291,7 +273,10 @@ You can see the complete command line that ndk-build is using by passing V=1 on
ndk-build V=1
-If your application crashes in native code, you can use addr2line to convert the
+If your application crashes in native code, you can use ndk-stack to get a symbolic stack trace:
+ https://developer.android.com/ndk/guides/ndk-stack
+
+If you want to go through the process manually, you can use addr2line to convert the
addresses in the stack trace to lines in your code.
For example, if your crash looks like this: