DEV Community

loading...

What Should I Do If the Crash Report Cannot Be Obtained When Using the Crash Service?

Zachary Powell
With over 10 years experience in Android development Zachary now leads the AppGallery Connect Advocate team to promote the use of the tools and SDKs offered.
・2 min read

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:

  1. 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.

image

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();
    }
Enter fullscreen mode Exit fullscreen mode

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.

  1. 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.
image

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.
image

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

Discussion (0)