28
What Should I Do If the Crash Report Cannot Be Obtained When Using the Crash Service?
The Crash service of HUAWEI AppGallery Connect allows you to effortlessly complete service integration by adding the Crash SDK with no coding needed. Despite this, after integrating the service, you may fail to obtain crash reports in AppGallery Connect. You can locate the fault as follows:
- Check whether app crashes have been reported. Run the adb shell setprop log.tag.AGC_LOG VERBOSE command to enable the debugging mode of the Crash SDK. The message "upload success" indicates that the crash data is reported successfully by the app. If the message is not displayed, check the integration of the Crash SDK.
If no crash data is reported, call the testIt API to trigger a crash and add the following code to print the value of the crash handler.
Button btn_crash = findViewById(R.id.btn_crash);
btn_crash.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final String clzName = getTheDefaultCrashHandler();
if(isAGCCrashHandler(clzName)){
AGConnectCrash.getInstance().testIt();
} else{
Toast.makeText(MainActivity.this,
"the default crash handler is " + clzName,
Toast.LENGTH_SHORT).show();
}
}
});
private boolean isAGCCrashHandler(String clz){
if(clz.startsWith("com.huawei.agconnect.crash")) {
return true;
}
return false;
}
private String getTheDefaultCrashHandler(){
Thread.UncaughtExceptionHandler defCrashHandler = Thread.getDefaultUncaughtExceptionHandler();
return defCrashHandler.getClass().getName();
}
Ensure that the default crash handler is AppGallery Connect. If you have enabled other third-party crash services, AppGallery Connect Crash may fail to be initialized before the app crashes. In this case, you can disable all third-party crash services and try again. If it works, ensure that all integrated crash services do not conflict with each other.
- If the crash is reported but not displayed in AppGallery Connect, perform the following operations:
2.1 Ensure that your phone is connected to the Internet.
2.2 Ensure that the JSON file is added to the project after HUAWEI Analytics is enabled. The following information is contained in the JSON file.
2.3 Open the app again. Java crashes are reported immediately, while NDK crashes are reported when the app is reopened.
2.4 Go to HUAWEI Analytics > Overview > Real-time overview in AppGallery Connect and check whether the data is reported.
2.5 Go to Quality > Crash. Click both the Statistics and Search by user tabs to check whether there is a report. Sometimes the crash report is displayed on the Search by user tab page instead of Statistics by HUAWEI Analytics. The possible cause for this is because real-time data collection is stacked. In this case, contact Huawei technical support.
Reference: development guide of the Crash service
28