Project integration and testing
Lineage: https://github.com/forexample/ios-dynamic-framework sample by Ruslan Baratov. Includes updates for resymbolification tasks.
The end-to-end build + test should run automatically. The libmylib.so
shared library is installed in the yourapp
install tree, which should be relocatable. The app + lib are copied to the device /data/local/tmp
where it is launch via adb
commands to produce a stack trace that can be retrieved via adb locat
and "resymbolificated" using ndk-stack
.
- Shell:
cd integration/symbolification
# cd to symbolification sub-project - Shell:
./bin/build-android.sh
# build libmylib.so and yourapp, install + launch w/ adb commands - Shell:
./bin/symbolicate-android.sh
# resymbolicate
You will see ndk-stack
output with and without symbols, and it should look something like this:
***************************
***** NO SYMBOLS **********
***************************
********** Crash dump: **********
Build fingerprint: 'samsung/heroqlteuc/heroqlteatt:6.0.1/MMB29M/G930AUCS2APE1:user/release-keys'
pid: 16581, tid: 16581, name: yourapp >>> ./yourapp <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
Stack frame #00 pc 00008568 /data/local/tmp/work/libmylib.so (_ZN5mylib8crashsimEi+360)
Stack frame #01 pc 00003440 /data/local/tmp/work/yourapp
Stack frame #02 pc 00017449 /system/lib/libc.so (__libc_init+44)
Stack frame #03 pc 00003880 /data/local/tmp/work/yourapp
***************************
***** WITH SYMBOLS ********
***************************
********** Crash dump: **********
Build fingerprint: 'samsung/heroqlteuc/heroqlteatt:6.0.1/MMB29M/G930AUCS2APE1:user/release-keys'
pid: 16581, tid: 16581, name: yourapp >>> ./yourapp <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
Stack frame #00 pc 00008568 /data/local/tmp/work/libmylib.so (_ZN5mylib8crashsimEi+360): Routine mylib::some_bad_func(int) at /tmp/integration/symbolification/mylib/mylib.cpp:15
Stack frame #01 pc 00003440 /data/local/tmp/work/yourapp
Stack frame #02 pc 00017449 /system/lib/libc.so (__libc_init+44)
Stack frame #03 pc 00003880 /data/local/tmp/work/yourapp
Note: If the *.crash
file is retrieved on the same machine used to build libmylib.framework
, then Xcode magically resymbolicates the file for you. It seems there is some behind the scenes book-keeping occurring in Xcode. I was eventually able to test this end-to-end process properly by downloading the raw *.crash
log file on a different machine, and then moving it back to the development machine. This wasn't obvious at first, however CMake is stripping teh shared framework properly.
The end-to-end build + test should run automatically. The mylib.framework
framework is copied toyourapp
in CMakeLists.txt and the final yourapp.app
is launched on the device using ios-deploy
. If you experience trouble, or the framework isn't inserted properly, follow the (optional) instructions below for adding the framework manually. (I've added the manual instructions since the framework embedding is somewhat non-standarda (there is no XCODE_ATTRIBUTE_*
property to control this is CMake, so I don't know how durable this is -- the manual process should always work). For simplicity, all scripts below should be run from the top level symbolification directory as follows: ./bin/some-script-name.sh
.
TODO: Retrieve *.crash file programmatically?
- Shell:
cd integration/symbolification
# cd to symbolification sub-project - Shell:
export MY_IOS_IDENTITY="iPhone Developer: Your Name (XXXXXXXXXX)"
# insert real values here - Shell:
(cd /tmp && git clone https://github.com/phonegap/ios-deploy.git && cd ios-deploy && xcodebuild && npm install --unsafe-perm=true --allow-root -g ios-deploy)
# install ios-deploy for automation - Shell:
./bin/build-ios.sh
# build mylib.framework, yourapp.app+mylib.framework and launch w/ ios-deploy - Xcode: Window -> Devices -> Your iPhone -> [View Device Logs] -> This Device ->
yourapp
- (Cont) right-click -> export -> save as: "your_app_log1". : # see not above about retrieving crash logs on a different machine
- Shell:
./bin/symbolicate-ios.sh ${HOME}/Downloads/your_app_log1.crash > /tmp/symbolicated.txt
# read this script for further details on the process
See: Following https://possiblemobile.com/2015/03/symbolicating-your-ios-crash-reports/
You are done. Read the following sections as needed.
Backup manual approach for embedding frameworks (currently performed by CMake and should not be required):
- Xcode: File -> Add Files To Your App :
mylib/_framework/ios-10-1-dep-8-0-hid-sections/mylib.framework
- Xcode: Target = yourapp General -> Embed Binaries -> + -> mylib.framework
- Xcode: Select iPhone device and run
yourapp
target - Xcode: Stop the app. You can run again from the installed icon (this seems to be required to actually creat the stack).
https://developer.apple.com/library/content/technotes/tn2151/_index.html https://www.raywenderlich.com/23704/demystifying-ios-application-crash-logs