42
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:

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.
2.1 Ensure that your phone is connected to the Internet.
2.3 Open the app again. Java crashes are reported immediately, while NDK crashes are reported when the app is reopened.
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
42