summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2017-09-05 17:40:56 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2017-09-07 22:03:10 +0200
commit2e8e0b213a3cbac802515cd9255286b26d3bba60 (patch)
treeab2604f78186fa3308e85cfbc8f0a2c406140cfb /android
parent9a920bf9c96468c29505eab15f80d45e5f296597 (diff)
android: drop workarounds for ndk-gdb support (can still run manually)
packing gdbserver into apk conflicts with extractNativeLibs="false", as the gradle pugin compresses it (which could be disabled using aaptOptions), but furthermore it doesn't page-align it, breaking installation. So instead let the user manually push the gdbserver tool to device and remove the hardcoded values that were only there to please the ndk-gdb scripts. Using lldb from within Android Studio is more comfortable anyway :-) Change-Id: I31c3af4847a479c56b3fcd6b5bed114e004bf0d2 Reviewed-on: https://gerrit.libreoffice.org/41950 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'android')
-rw-r--r--android/.gitignore2
-rw-r--r--android/Bootstrap/Makefile.shared2
-rw-r--r--android/README37
-rw-r--r--android/source/AndroidManifest.xml1
-rw-r--r--android/source/Makefile2
-rw-r--r--android/source/build.gradle36
6 files changed, 19 insertions, 61 deletions
diff --git a/android/.gitignore b/android/.gitignore
index c93775722a5e..19c3690b3ab7 100644
--- a/android/.gitignore
+++ b/android/.gitignore
@@ -7,9 +7,7 @@
/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/Bootstrap/Makefile.shared b/android/Bootstrap/Makefile.shared
index e06e36cdac54..332192918e9c 100644
--- a/android/Bootstrap/Makefile.shared
+++ b/android/Bootstrap/Makefile.shared
@@ -99,8 +99,6 @@ liboSettings.gradle: $(BUILDDIR)/config_build.mk $(BUILDDIR)/config_host.mk
&& echo " liboVersionMajor = '$(LIBO_VERSION_MAJOR)'" \
&& echo " liboVersionMinor = '$(LIBO_VERSION_MINOR)'" \
&& echo " liboGitFullCommit = '$(shell cd $(SRCDIR) && git log -1 --format=%H)'" \
- && echo " liboNdkGdbserver = '$(ANDROID_NDK_GDBSERVER)'" \
- && echo " liboAndroidAppAbi = '$(ANDROID_APP_ABI)'" \
&& echo "}" \
&& echo "android.defaultConfig {" \
&& echo " applicationId '$(ANDROID_PACKAGE_NAME)'" \
diff --git a/android/README b/android/README
index 118e5ff6113f..ce7c3be7a603 100644
--- a/android/README
+++ b/android/README
@@ -210,25 +210,19 @@ swap).
* Using ndk-gdb
-When you have all this, install the .apk to the device, and:
-
- cd android/source
- <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\"
-
+Direct support for using ndk-gdb has been removed from the build system. It is
+recommended that you give the lldb debugger a try that has the benefit of being
+nicely integrated into Android Studio (see below for instructions).
+If you nevertheless want to continue using ndk-gdb, use the following steps
+that are described in more detail here: https://stackoverflow.com/a/10539883
+
+ - add android:debuggable="true" to AndroidManifest.xml
+ - push gdbserver to device, launch and attach to application
+ - forward debugging port from host to device
+ - launch matching gdb on host and run following setup commands:
+ - set solib-search-path obj/local/<appAbi>
+ - file obj/local/<appAbi>/liblo-native-code.so
+ - target remote :<portused>
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
@@ -239,8 +233,9 @@ rtl::OString, you need:
* Using Android Studio (and thus lldb)
-Note that both might not yield the same results - so if lldb doesn't show you
-useful info, try with the ndk-gdb method and the other way round.
+Note that lldb might not yield the same results as ndk-gdb. If you suspect a
+problem with lldb, you can try to manually use ndk-gdb as described above.
+Using lldb from within Android Studio is more comfortable though and works like this:
- open android/source/build.gradle in Android Studio via File|New → Import Project
- make sure you select the right build variant (strippedUIDebug is what you want)
diff --git a/android/source/AndroidManifest.xml b/android/source/AndroidManifest.xml
index 97db04865f1e..c2a3656f8e92 100644
--- a/android/source/AndroidManifest.xml
+++ b/android/source/AndroidManifest.xml
@@ -17,7 +17,6 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/LibreOfficeTheme"
- android:debuggable="true"
android:hardwareAccelerated="true"
android:largeHeap="false">
diff --git a/android/source/Makefile b/android/source/Makefile
index 9a84def6fe7b..d0242117d1a8 100644
--- a/android/source/Makefile
+++ b/android/source/Makefile
@@ -36,4 +36,4 @@ run:
$(ANDROID_SDK_HOME)/platform-tools/adb shell am start -n $(ANDROID_PACKAGE_NAME)/.ui.LibreOfficeUIActivity
debugrun:
- $(SYSBASE)/../../../ndk-gdb --start
+ @echo "please debug with lldb from within Android Studio, or setup ndk-gdb manually (see android/README for details)"
diff --git a/android/source/build.gradle b/android/source/build.gradle
index 1421f000de23..5f850c197122 100644
--- a/android/source/build.gradle
+++ b/android/source/build.gradle
@@ -40,24 +40,15 @@ 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 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'
}
- 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,
@@ -209,27 +200,6 @@ 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 and Application.mk for use with ndk-gdb"
- inputs.file "liboSettings.gradle"
- 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 {
- file("libs/${liboAndroidAppAbi}").mkdirs()
- gdbsetup.text = "set solib-search-path ./obj/local/${liboAndroidAppAbi}\n"
- applicationmk.text = "APP_ABI := ${liboAndroidAppAbi}\n"
- }
-}
-
task createRCfiles {
inputs.file "liboSettings.gradle"
dependsOn copyUnpackAssets, copyAssets
@@ -287,10 +257,8 @@ task createRCfiles {
preBuild.dependsOn 'createRCfiles',
'createStrippedConfigMain',
'createStrippedConfigRegistry',
- 'createFullConfig',
- 'copyNdkDebugServer'
+ 'createFullConfig'
clean.dependsOn 'cleanCopyAssets',
'cleanCreateStrippedConfig',
- 'cleanCreateFullConfig',
- 'cleanCopyNdkDebugServer'
+ 'cleanCreateFullConfig'