应用程式当机,执行CustomActivityOnCrash的UncaughtExceptionHandler

时间:2018-09-18 01:33:02

标签: android

我遇到一个奇怪的问题。.我正在尝试将ACRA与customcrashactivity库一起使用..但是无论何时发生崩溃(故意这样做)..都会发送崩溃报告,但customcrash活动仅出现有时..其他时候应用程序冻结并停止反应..您认为是什么问题..我寻找了一会儿解决办法,但没有运气..  Application.Java

@ReportsCrashes(
        formUri = "https://collector.tracepot.com/79****",
        reportType = org.acra.sender.HttpSender.Type.JSON,
        httpMethod = org.acra.sender.HttpSender.Method.PUT,
        alsoReportToAndroidFramework=true,
        mode = ReportingInteractionMode.TOAST,
        resToastText = R.string.crash_toast_text
)
public class MyApplication extends Application {    

        @Override
        public void onCreate() {
            super.onCreate();

            CaocConfig.Builder.create()
                    .apply();

            ACRA.init(this);


        }

清单

 <application
        android:name=".MyApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"

 <activity android:name=".CustomErrorActivity"
            android:process=":error_activity"
            >
            <intent-filter>
                <action android:name="cat.ereza.customactivityoncrash.ERROR" />
            </intent-filter>
        </activity>

CustomErrorActivity:

public class CustomErrorActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_custom_error);
    }

    public void restart (View view){
        finishAffinity();
        startActivity(new Intent(getApplicationContext(), MainActivity.class));
    }

}

Gradle

compile 'ch.acra:acra:4.9.2'
compile 'cat.ereza:customactivityoncrash:2.2.0'

错误:

09-18 02:32:26.629 25629-25957/? E/CustomActivityOnCrash: App has crashed, executing CustomActivityOnCrash's UncaughtExceptionHandler
    java.lang.InternalError: Thread starting during runtime shutdown
        at java.lang.Thread.nativeCreate(Native Method)
        at java.lang.Thread.start(Thread.java:733)
        at android.app.SharedPreferencesImpl.startLoadFromDisk(SharedPreferencesImpl.java:119)
        at android.app.SharedPreferencesImpl.<init>(SharedPreferencesImpl.java:112)
        at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:392)
        at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:373)
        at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:167)
        at cat.ereza.customactivityoncrash.CustomActivityOnCrash.getLastCrashTimestamp(CustomActivityOnCrash.java:673)
        at cat.ereza.customactivityoncrash.CustomActivityOnCrash.hasCrashedInTheLastSeconds(CustomActivityOnCrash.java:683)
        at cat.ereza.customactivityoncrash.CustomActivityOnCrash.access$200(CustomActivityOnCrash.java:52)
        at cat.ereza.customactivityoncrash.CustomActivityOnCrash$1.uncaughtException(CustomActivityOnCrash.java:112)
        at org.acra.builder.ReportExecutor.endApplication(ReportExecutor.java:269)
        at org.acra.builder.ReportExecutor.dialogAndEnd(ReportExecutor.java:254)
        at org.acra.builder.ReportExecutor.access$400(ReportExecutor.java:42)
        at org.acra.builder.ReportExecutor$2.run(ReportExecutor.java:217)

0 个答案:

没有答案