我正在使用ACRA获取崩溃报告,我的应用程序因以下错误而崩溃。
java.lang.IllegalStateException: ACRA#init called more than once
at org.acra.ACRA.init(ACRA.java:121)
at com.m7.nomad.NomadApplication.onConfigurationChanged(NomadApplication.java:15)
at android.app.ActivityThread.performConfigurationChanged(ActivityThread.java:3515)
at android.app.ActivityThread.handleConfigurationChanged(ActivityThread.java:3655)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1128)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:4369)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:846)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:604)
at dalvik.system.NativeStart.main(Native Method)
知道如何解决这个问题吗?
答案 0 :(得分:0)
我认为这很明确=> ACRA.init方法被调用两次(或更多次)
为什么在onConfigurationChanged方法中初始化ACRA?
每次更改配置时都会调用onConfigurationChanged(好的演绎Dr Watson ......):例如,当您更改手机的方向时,......您应该在Application.onCreate方法中初始化ACRA(只调用一次):
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
ACRA.init(this);
}
}