Updated Android project files and documentation

This commit is contained in:
Sam Lantinga 2018-10-28 10:31:06 -07:00
parent 14c55ac890
commit e381a1599d
6 changed files with 19 additions and 40 deletions

View file

@ -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')
}

View file

@ -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

View file

@ -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" />

View file

@ -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()
}
}

View file

@ -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

View file

@ -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: