简体   繁体   中英

How to force crash for NDK in Android for testing in firebase crashlytics?

I have enabled NDK support for crashlytics for my Android project following this documentation:

https://firebase.google.com/docs/crashlytics/ndk-reports

However the force crash mentioned in it is a simple crash and not a NDK crash. I need to check if it is working as expected before moving this implementation to production. Can anyone tell me how to force crash for testing NDK crashes in order to test this implementation.

For this you need to cause the test crash from your native code. You can try with something like this:

int* foo = (int*)-1;
printf("%d\n", *foo);
return *foo;

You could have a button that calls a native function that runs the above code so you have more control on when to crash the app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM