How to locate errors encountered in Android NDK development
The NDK compiles the generated. So file as part of the program, which also causes the program to crash when an exception is run. Unlike the Java code exception caused by the program crashes, when the NDK exception occurs, the program on the Android device will immediately exit, that is, usually said the flashback, and will not pop up "program XXX no response, whether immediately close" such as the Prompt box.
The NDK is developed using C + +, and programmers familiar with C + + know that pointers and memory management are the most important and most problematic places, with a slight loss of common problems such as invalid memory access, invalid objects, memory leaks, stack overflows, and finally the same result: program crashes. For example, we often say null pointer error, that is, when a memory pointer is set to NULL (NULL) and then access it again, another common mistake is to release a memory space somewhere in the program, and then try to access the memory address elsewhere in the program, resulting in an invalid address error. Common types of errors are as follows:
initialization error;
Access error;
Memory leaks;
Parameter error;
Stack overflow;
type conversion error;
Number except 0 error.
1, the first method: Ndk-stack
adb shell Logcat|ndk-stack-sym $PROJECT _path/obj/local/armeabi
Or get log re-analysis first.
adb shell Logcat > Log.txt
Ndk-stack-sym $PROJECT _path/obj/local/armeabi-udmp Log.txt
2. Second method: Use Addr2line and Objdump commands
These two methods can reveal how the ndk-stack command works
ARM-LINUX-ADNROIDEABI-ADDR2LINE-E obj/local/armeabi/*.so Address: Number of anchor rows
Arm-linux-adnroideabi-addr2line-f-E obj/local/armeabi/*.so Address: locating function information
3. Third-party SDK
testflight--Perfect Iosapp test solution: http://onevcat.com/2012/01/testflight/
Crittercism of foreign countries
Domestic Testintestin: Fees and charges
testflight--the perfect iOS app test solution
Crash Report class:
Crittercism personal use for a period of time, performance is very stable, but the version of the update is more difficult to set up
Crashlytics is quite elegant and convenient, recently acquired by Twitter. Very recommended
User Behavior Statistics Class:
Flurry, this is so famous, don't say much.
countly benefits are lightweight open source, data can be controlled by itself
Bugsense
However, in the "pre-release" Test distribution, there is basically no testflight to match the emergence of services, so if there are testing requirements, TF is still the first choice for developers.
Android JNI crash Stack information analysis