summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2015-10-14 02:32:57 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2015-10-14 02:32:57 +0200
commit78cf4ca4405d33d3f658da0d7f209afc8e6ee4a7 (patch)
tree389619b8ea7603f7da1839d4391a528ce46e208e /android
parent2511a21841dd9dec735a53add8174e47d24deb88 (diff)
make ndk-gdb work again
it hardcodes so much :-( Change-Id: Id86c2bcbf5936f3ab292e87210b967e2331c9435
Diffstat (limited to 'android')
-rw-r--r--android/.gitignore2
-rw-r--r--android/README23
-rw-r--r--android/source/AndroidManifest.xml3
-rw-r--r--android/source/ReleaseManifest.xml7
-rw-r--r--android/source/build.gradle27
5 files changed, 47 insertions, 15 deletions
diff --git a/android/.gitignore b/android/.gitignore
index 048756239172..c93775722a5e 100644
--- a/android/.gitignore
+++ b/android/.gitignore
@@ -5,9 +5,11 @@
/source/assets_strippedUI/
/source/build/
/source/captures/
+/source/jni/Application.mk
/source/jniLibs/
/source/jniLibs_debug/
/source/liboSettings.gradle
+/source/libs/*/gdb.setup
/source/local.properties
/source/native-code.cxx
/source/obj/
diff --git a/android/README b/android/README
index 513444c9754e..8f40d5a47336 100644
--- a/android/README
+++ b/android/README
@@ -198,16 +198,25 @@ Building with all symbols is also possible but the linking is currently
slow (around 10 to 15 minutes) and you need lots of memory (around 16GB + some
swap).
-You also want to avoid --with-android-package-name (or when you use
-that, you must set it to "org.libreoffice"), otherwise ndk-gdb will complain:
-
- ERROR: Could not extract package's data directory. Are you sure that
- your installed application is debuggable?
-
When you have all this, install the .apk to the device, and:
cd android/source
- <android-ndk-r10d>/ndk-gdb --adb=<android-sdk-linux>/platform-tools/adb --start
+ <ndk-bundle>/ndk-gdb --adb=<android-sdk-linux>/platform-tools/adb [--start]
+
+In case you used --with-android-package-name, add --package=your.package.name
+to the invocation
+
+If you get the error
+
+ ERROR: Could not find gdb.setup under ./libs/
+
+(and an empty "Compatible device ABI:" when run with --verbose), you need to fix
+the quoting in the ndk-gdb script:
+
+@@ -574 +574 @@
+-adb_var_shell BCFILES run-as $PACKAGE_NAME /system/bin/sh -c "ls lib/*.bc"
++adb_var_shell BCFILES run-as $PACKAGE_NAME /system/bin/sh -c \"ls lib/*.bc\"
+
Pretty printers aren't loaded automatically due to the single shared
object, but you can still load them manually. E.g. to have a pretty-printer for
diff --git a/android/source/AndroidManifest.xml b/android/source/AndroidManifest.xml
index f15e66f083a7..7721c6971dc6 100644
--- a/android/source/AndroidManifest.xml
+++ b/android/source/AndroidManifest.xml
@@ -13,6 +13,7 @@
android:allowBackup="true"
android:icon="@drawable/main"
android:label="@string/app_name"
+ android:debuggable="true"
android:hardwareAccelerated="true"
android:largeHeap="false">
@@ -94,7 +95,7 @@
</activity>
<!-- Document Browser Activity -->
- <activity android:name=".ui.LibreOfficeUIActivity"
+ <activity android:name="org.libreoffice.ui.LibreOfficeUIActivity"
android:label="@string/app_name"
android:theme="@style/BrowserTheme">
<intent-filter>
diff --git a/android/source/ReleaseManifest.xml b/android/source/ReleaseManifest.xml
new file mode 100644
index 000000000000..e412fe9fc508
--- /dev/null
+++ b/android/source/ReleaseManifest.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools">
+ <application android:debuggable="false" tools:replace="android:debuggable"/>
+</manifest>
+<!-- vim: shiftwidth=4 softtabstop=4 expandtab:
+-->
diff --git a/android/source/build.gradle b/android/source/build.gradle
index 3f476c22fd07..80772b212c88 100644
--- a/android/source/build.gradle
+++ b/android/source/build.gradle
@@ -24,7 +24,6 @@ dependencies {
])
compile files("${liboInstdir}/${liboShareJavaFolder}/unoil.jar")
compile files("${liboWorkdir}/UnpackedTarball/owncloud_android_lib/bin/owncloud-android-library.jar")
- compile 'com.android.support:support-v4:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
}
@@ -39,18 +38,24 @@ android {
// ToDo move to conventional layout, so stuff can be stripped down.
sourceSets {
main.manifest.srcFile 'AndroidManifest.xml'
+ // override the debuggable flag that needs to be in AndroidManifest.xml
+ // since ndk-gdb awks for the literal string in there :-/
+ release.manifest.srcFile 'ReleaseManifest.xml'
main.assets.srcDirs = ['assets']
main.res.srcDirs = ['res']
main.java.srcDirs = ['../Bootstrap/src', 'src/java']
main.jniLibs.srcDirs = ['jniLibs']
main.jni.srcDirs = [] // don't attempt to build native-lib via gradle
- // gdbserver stuff from separate dir
+ // gdbserver for debugvariant
debug.jniLibs.srcDirs "jniLibs_debug"
// the configuration data that might be stripped or not
fullUI.assets.srcDirs 'assets_fullUI'
strippedUI.assets.srcDirs 'assets_strippedUI'
}
- // defaults for Manifest
+ lintOptions {
+ // ndk-gdb looks for the literal value in the pre-processed manifest :-(
+ disable 'HardcodedDebugMode'
+ }
defaultConfig {
minSdkVersion 14
// openssl on x86 makes the native-code.so contain text-relocations,
@@ -197,16 +202,24 @@ task createStrippedConfigRegistry(type: Exec) {
}
}
+// ndk-gdb requires the gdb.setup to be in libs/<arch>/ folder - it's hardcoded in the script
+// it should in theory also be able to copy the gdbserver binary onto the device, but the matching
+// against prebuilt archs is too rudimentary and doesn't map armeabi-v7 to arm for example
task copyNdkDebugServer(type: Copy) {
- description "copies gdbserver into and creates gdb.setup in the debug-type only native directory"
+ description "copies gdbserver into and creates gdb.setup and Application.mk for use with ndk-gdb"
inputs.file "liboSettings.gradle"
- def gdbsetup = file("jniLibs_debug/${liboAndroidAppAbi}/gdb.setup")
- outputs.file gdbsetup
+ def gdbsetup = file("libs/${liboAndroidAppAbi}/gdb.setup") // only needed on buildhost
+ // hardcoded path from ndk-gdb - reads the host architecture from that file
+ def applicationmk = file("jni/Application.mk")
+ outputs.files gdbsetup, applicationmk
outputs.dir 'jniLibs_debug' // own the directory, so it is removed on this task's clean
+ outputs.dir 'libs' // own the directory, so it is removed on this task's clean
into "jniLibs_debug/${liboAndroidAppAbi}"
from "${liboNdkGdbserver}"
doLast {
- gdbsetup.text = "set solib-search-path ./obj/local/${liboAndroidAppAbi}"
+ file("libs/${liboAndroidAppAbi}").mkdirs()
+ gdbsetup.text = "set solib-search-path ./obj/local/${liboAndroidAppAbi}\n"
+ applicationmk.text = "APP_ABI := ${liboAndroidAppAbi}\n"
}
}