Safely calls an Android native function, guaranteed function crashes at most once.
Add the following code block to the project's build.gradle
or settings.gradle
(gradle7.0+).
repositories {
...
maven { url 'https://jitpack.io' }
}
Add the following code block to the module's build.gradle
.
android {
...
buildFeatures {
prefab true
}
}
dependencies {
implementation 'com.github.luoyesiqiu:SafeCall:1.0.1'
}
Add following code block to CMakeLists.txt
.
find_package(safecall REQUIRED CONFIG)
target_link_libraries(myapp safecall::safecall)
Includes this header file in your project.
#include "safe_call.h"
void problem_call() {
//This function may throw some crashes.
...
}
SAFE_CALL_VOID(problem_call);
int problem_call(int arg) {
//This function may throw some crashes.
...
return 0;
}
int ret = 0;
SAFE_CALL(problem_call,ret,123);