Capture Crash and Error Logs
Foxit PDF SDK provides setExceptionLogger to output exception and crash logs. This capability depends on the third-party xCrash library; add the dependency and configuration first, then follow the steps below.
Use Cases
- The app crashes and the cause is unclear
- You need crash logs for technical support
1) Add Dependency
kotlin
dependencies {
implementation 'com.iqiyi.xcrash:xcrash-android-lib:2.1.4'
}2) Configure Required ABIs
kotlin
android {
defaultConfig {
ndk {
abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
}
}
}3) Call setExceptionLogger in Code
java
public class MainApplication extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
PDFViewCtrl.setExceptionLogger(this,
Environment.getExternalStorageDirectory().getAbsolutePath() + "/FoxitSDK/crash",
new PDFViewCtrl.IExceptionLogger() {
@Override
public void onExceptionLogger(String filePath) {
Log.d("", "onExceptionLogger: " + filePath);
}
});
}
}Verify and Collect Logs
- Run the app and trigger an exception or crash.
- Check log files in the directory specified by
setExceptionLogger(example:.../FoxitSDK/crash). - Package that directory and provide it to technical support if needed.