Override fprintf(stderr) in android_debug.h

This commit is contained in:
Sergii Pylypenko
2015-02-17 22:35:56 +02:00
parent 883840e866
commit 7ddc35b6e8
4 changed files with 27 additions and 3 deletions

View File

@@ -350,7 +350,7 @@ Quick guide to debug native code
================================
You need compile your app with debug enabled to be able to debug native code:
./build.sh debug
./build.sh debug
To debug your application - launch it, go to "project" dir and launch command
ndk-gdb
then you can run usual GDB commands, like:
@@ -364,6 +364,10 @@ You can also debug by adding extensive logs to your app:
__android_log_print(ANDROID_LOG_INFO, "My App", "We somehow reached execution point #224");
and then watching "adb logcat" output.
Android does not print app stdout/stderr streams to logcat, so printf() will not work,
but you can redefine printf() and fprintf(stderr) in your app to write to Android log by adding this to AppCflags:
-include jni/application/android_debug.h
If your application crashed, you should use following steps:
1. Gather the crash report from "adb logcat" - it should contain stack trace, if it does not then you're unlucky,