它適用於Android 5.0,但它不適用於Jellybean設備。如果我使用ACRA,則不會調用Android UncaughtExceptionHandler
@ReportsCrashes(
formKey = "", // This is required for backward compatibility but not used
formUri = "dummyurl",
reportType = org.acra.sender.HttpSender.Type.JSON,
httpMethod = org.acra.sender.HttpSender.Method.PUT,
formUriBasicAuthLogin="adminTest",
formUriBasicAuthPassword="adminTest",
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text)
public class Application extends Application {
@Override
public void onCreate() {
super.onCreate();
init();
ACRA.init(this);
Thread.setDefaultUncaughtExceptionHandler(sUncaughtExceptionHandler);
}
private UncaughtExceptionHandler sUncaughtExceptionHandler = new UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread thread, Throwable ex) {
Log.i(LogTag, "uncaughtException: ");
dummyMethod();
Thread.getDefaultUncaughtExceptionHandler().uncaughtException(
thread, ex);
}
};
}
我不知道它爲什麼在L中工作,但這裏錯了,你要設置兩個你手動分配的UncaughtExceptionHandler,一個ACRA正在爲你創建,這是不對的。 –