in my android application, I use my own C ++ library through JNI. This library creates log lines if it is built in debug mode. I want the log lines to be redirected to logcat.
So, I created lib in debug mode,
NDK_DEBUG=1and is used
LOCAL_LDLIBS += -llog.
My devices are not deployed, but I installed:
$ adb shell stop
$ adb shell setprop log.redirect-stdio true
$ adb shell start
As described in http://developer.android.com/tools/debugging/debugging-log.html#viewingStd and here Is "std :: cout"; can be used in android ndk
The use __android_log_print(ANDROID_LOG_INFO, "foo", "Error: %s", foobar);works, but this is not an option for me, because C ++ lib is also used for the iOS application, so I do not want to change my own code.
I also tried to get the console output (printf) generated in the JNI shell with these settings, but besides the __android_log_print statements, the output also does not distort the logarithmic file.
Am I missing or redirecting something only for root devices?
How can I get console output generated by native code.
Thank you at Advance
source
share