in my Android app I use a native c++ library via JNI. This library produces log lines, if its build in debug mode. I want to have the log lines redirected to logcat.
So I created the lib in debug mode,
NDK_DEBUG=1
is used and
LOCAL_LDLIBS += -llog
is set.
My devices is not rooted but I set:
$ adb shell stop
$ adb shell setprop log.redirect-stdio true
$ adb shell start
Like it was described at http://developer.android.com/tools/debugging/debugging-log.html#viewingStd and here Is "std::cout" usable in Android-ndk
Using __android_log_print(ANDROID_LOG_INFO, "foo", "Error: %s", foobar);
is working but it is not an option for me because the c++ lib is also used for an iOS app so I dont want to change the native code.
I also tried to get the console output (printf) created in the JNI wrapper with this settings but except the "__android_log_print" statements the output is not visble a logcat too.
Did I missed something or is the redirection only possible for rooted devices?
How can I get the console output produced by native code.
Thank You in Advance