Search code examples
androidhuawei-mobile-serviceshuawei-developers

Integrated Huawei Crash service but crashes do not appear in web console


I have integrated Huawei AGC crash service like in the official documentation but crashes do not appear in AppGallery Web Console. Any idea what I might be missing?


Solution

    1. Have you enabled the Analytics kit and integrated the Analytics kit?
    2. Have you invoked AGConnectCrash.getInstance().testIt() method for testing? And after your App crash, you should re-open your APP then the crash information will be uploaded to cloud in a few seconds, so please make sure your mobile internet connection is available during this time.
    3. Have you used third-party crash service? Or do you have your own CrashHandler which implements Thread.UncaughtExceptionHandler?

    Please add the following code to your project to check the default crash handler, normally it should be "com.huawei.agconnect.crash", if the result is a third-party crash service, please try to disable it or contact with third-party for help.

            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();
    }