Updated Android project files and documentation
authorSam Lantinga <slouken@libsdl.org>
Sun, 28 Oct 2018 10:31:06 -0700
changeset 12364351a67dbe9c6
parent 12363 aa3ad38b7809
child 12365 09e3ef028bc8
Updated Android project files and documentation
android-project/app/build.gradle
android-project/app/jni/Application.mk
android-project/app/src/main/AndroidManifest.xml
android-project/build.gradle
android-project/gradle/wrapper/gradle-wrapper.properties
docs/README-android.md
     1.1 --- a/android-project/app/build.gradle	Fri Oct 26 20:20:28 2018 -0700
     1.2 +++ b/android-project/app/build.gradle	Sun Oct 28 10:31:06 2018 -0700
     1.3 @@ -9,7 +9,6 @@
     1.4  
     1.5  android {
     1.6      compileSdkVersion 26
     1.7 -    buildToolsVersion "26.0.1"
     1.8      defaultConfig {
     1.9          if (buildAsApplication) {
    1.10              applicationId "org.libsdl.app"
    1.11 @@ -21,10 +20,9 @@
    1.12          externalNativeBuild {
    1.13              ndkBuild {
    1.14                  arguments "APP_PLATFORM=android-14"
    1.15 -                abiFilters 'armeabi-v7a', 'x86'
    1.16 +                abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
    1.17              }
    1.18          }
    1.19 -        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    1.20      }
    1.21      buildTypes {
    1.22          release {
    1.23 @@ -61,9 +59,5 @@
    1.24  }
    1.25  
    1.26  dependencies {
    1.27 -    compile fileTree(include: ['*.jar'], dir: 'libs')
    1.28 -    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    1.29 -        exclude group: 'com.android.support', module: 'support-annotations'
    1.30 -    })
    1.31 -    testCompile 'junit:junit:4.12'
    1.32 +    implementation fileTree(include: ['*.jar'], dir: 'libs')
    1.33  }
     2.1 --- a/android-project/app/jni/Application.mk	Fri Oct 26 20:20:28 2018 -0700
     2.2 +++ b/android-project/app/jni/Application.mk	Sun Oct 28 10:31:06 2018 -0700
     2.3 @@ -1,7 +1,8 @@
     2.4  
     2.5  # Uncomment this if you're using STL in your project
     2.6 -# See CPLUSPLUS-SUPPORT.html in the NDK documentation for more information
     2.7 -# APP_STL := stlport_static
     2.8 +# You can find more information here:
     2.9 +# https://developer.android.com/ndk/guides/cpp-support
    2.10 +# APP_STL := c++_shared
    2.11  
    2.12  APP_ABI := armeabi-v7a arm64-v8a x86 x86_64
    2.13  
     3.1 --- a/android-project/app/src/main/AndroidManifest.xml	Fri Oct 26 20:20:28 2018 -0700
     3.2 +++ b/android-project/app/src/main/AndroidManifest.xml	Sun Oct 28 10:31:06 2018 -0700
     3.3 @@ -8,9 +8,6 @@
     3.4      android:versionName="1.0"
     3.5      android:installLocation="auto">
     3.6  
     3.7 -    <!-- Android 4.0.1 -->
     3.8 -    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="16" />
     3.9 -
    3.10      <!-- OpenGL ES 2.0 -->
    3.11      <uses-feature android:glEsVersion="0x00020000" />
    3.12  
     4.1 --- a/android-project/build.gradle	Fri Oct 26 20:20:28 2018 -0700
     4.2 +++ b/android-project/build.gradle	Sun Oct 28 10:31:06 2018 -0700
     4.3 @@ -3,9 +3,10 @@
     4.4  buildscript {
     4.5      repositories {
     4.6          jcenter()
     4.7 +        google()
     4.8      }
     4.9      dependencies {
    4.10 -        classpath 'com.android.tools.build:gradle:2.3.3'
    4.11 +        classpath 'com.android.tools.build:gradle:3.2.0'
    4.12  
    4.13          // NOTE: Do not place your application dependencies here; they belong
    4.14          // in the individual module build.gradle files
    4.15 @@ -15,6 +16,7 @@
    4.16  allprojects {
    4.17      repositories {
    4.18          jcenter()
    4.19 +        google()
    4.20      }
    4.21  }
    4.22  
     5.1 --- a/android-project/gradle/wrapper/gradle-wrapper.properties	Fri Oct 26 20:20:28 2018 -0700
     5.2 +++ b/android-project/gradle/wrapper/gradle-wrapper.properties	Sun Oct 28 10:31:06 2018 -0700
     5.3 @@ -3,4 +3,4 @@
     5.4  distributionPath=wrapper/dists
     5.5  zipStoreBase=GRADLE_USER_HOME
     5.6  zipStorePath=wrapper/dists
     5.7 -distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
     5.8 +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
     6.1 --- a/docs/README-android.md	Fri Oct 26 20:20:28 2018 -0700
     6.2 +++ b/docs/README-android.md	Sun Oct 28 10:31:06 2018 -0700
     6.3 @@ -77,18 +77,16 @@
     6.4     and rename it to the name of your project.
     6.5  2. Move or symlink this SDL directory into the "<project>/app/jni" directory
     6.6  3. Edit "<project>/app/jni/src/Android.mk" to include your source files
     6.7 -4. Run 'ndk-build' (a script provided by the NDK). This compiles the C source
     6.8  
     6.9 -If you want to use Android Studio (recommended), skip to the Android Studio section below.
    6.10 +4a. If you want to use Android Studio, simply open your <project> directory and start building.
    6.11  
    6.12 -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
    6.13 +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
    6.14  
    6.15  Here's an explanation of the files in the Android project, so you can customize them:
    6.16  
    6.17      android-project/app
    6.18          build.gradle            - build info including the application version and SDK
    6.19 -        src/main/AndroidManifest.xml	- package manifest. Among others, it contains the class name
    6.20 -        			  of the main Activity and the package name of the application.
    6.21 +        src/main/AndroidManifest.xml	- package manifest. Among others, it contains the class name of the main Activity and the package name of the application.
    6.22          jni/			- directory holding native code
    6.23          jni/Application.mk	- Application JNI settings, including target platform and STL library
    6.24          jni/Android.mk		- Android makefile that can call recursively the Android.mk files in all subdirectories
    6.25 @@ -216,26 +214,10 @@
    6.26  You can use STL in your project by creating an Application.mk file in the jni
    6.27  folder and adding the following line:
    6.28  
    6.29 -    APP_STL := stlport_static
    6.30 +    APP_STL := c++_shared
    6.31  
    6.32 -For more information check out CPLUSPLUS-SUPPORT.html in the NDK documentation.
    6.33 -
    6.34 -
    6.35 -================================================================================
    6.36 - Additional documentation
    6.37 -================================================================================
    6.38 -
    6.39 -The documentation in the NDK docs directory is very helpful in understanding the
    6.40 -build process and how to work with native code on the Android platform.
    6.41 -
    6.42 -The best place to start is with docs/OVERVIEW.TXT
    6.43 -
    6.44 -
    6.45 -================================================================================
    6.46 - Using Android Studio
    6.47 -================================================================================
    6.48 -
    6.49 -You can open your project directory with Android Studio and run it normally.
    6.50 +For more information go here:
    6.51 +	https://developer.android.com/ndk/guides/cpp-support
    6.52  
    6.53  
    6.54  ================================================================================
    6.55 @@ -291,7 +273,10 @@
    6.56  
    6.57      ndk-build V=1
    6.58  
    6.59 -If your application crashes in native code, you can use addr2line to convert the
    6.60 +If your application crashes in native code, you can use ndk-stack to get a symbolic stack trace:
    6.61 +	https://developer.android.com/ndk/guides/ndk-stack
    6.62 +
    6.63 +If you want to go through the process manually, you can use addr2line to convert the
    6.64  addresses in the stack trace to lines in your code.
    6.65  
    6.66  For example, if your crash looks like this: