wangyao5 / acra

Automatically exported from code.google.com/p/acra
0 stars 0 forks source link

ACRA.init(this) fails #88

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. After installing acra, just add the line ACRA.init(this) as instructed. The 
application will fail showing a black screen.
2. Add a try/catch with RuntimeException to catch when ACRA crashes

What is the expected output? What do you see instead?
This was a already running application. 
After I follow the instructions and installed ACRA, everytime I try to run the 
application I see only a black screen.
If I add a try/catch exception my application runs.

What version of the product are you using? On what operating system?
API 8. HTS Hero 2.1

Please provide any additional information below.
Code I try to see if was ACRA which was failing:

        try{
            ACRA.init(this); // The following line triggers the initialization of ACRA  
        }catch(RuntimeException e){
            android.util.Log.e(TAG, "ACRA init crashes: " + e.getMessage());
            e.printStackTrace();
        }   

ERROR:

10-30 22:02:37.908: WARN/System.err(2709): java.lang.NullPointerException
10-30 22:02:37.918: WARN/System.err(2709):     at 
org.acra.ErrorReporter.init(ErrorReporter.java:363)
10-30 22:02:37.918: WARN/System.err(2709):     at 
org.acra.ACRA.initAcra(ACRA.java:297)
10-30 22:02:37.918: WARN/System.err(2709):     at 
org.acra.ACRA.init(ACRA.java:238)
10-30 22:02:37.918: WARN/System.err(2709):     at 
com.hourglass.applications.MyApplication.onCreate(MyApplication.java:40)
10-30 22:02:37.918: WARN/System.err(2709):     at 
android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:969)
10-30 22:02:37.928: WARN/System.err(2709):     at 
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4165)
10-30 22:02:37.928: WARN/System.err(2709):     at 
android.app.ActivityThread.access$2900(ActivityThread.java:126)
10-30 22:02:37.928: WARN/System.err(2709):     at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1958)
10-30 22:02:37.928: WARN/System.err(2709):     at 
android.os.Handler.dispatchMessage(Handler.java:99)
10-30 22:02:37.928: WARN/System.err(2709):     at 
android.os.Looper.loop(Looper.java:123)
10-30 22:02:37.928: WARN/System.err(2709):     at 
android.app.ActivityThread.main(ActivityThread.java:4568)
10-30 22:02:37.928: WARN/System.err(2709):     at 
java.lang.reflect.Method.invokeNative(Native Method)
10-30 22:02:37.938: WARN/System.err(2709):     at 
java.lang.reflect.Method.invoke(Method.java:521)
10-30 22:02:37.938: WARN/System.err(2709):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
10-30 22:02:37.938: WARN/System.err(2709):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
10-30 22:02:37.938: WARN/System.err(2709):     at 
dalvik.system.NativeStart.main(Native Method)

Original issue reported on code.google.com by david.w....@gmail.com on 31 Oct 2011 at 2:14

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
The more I analyze the issue I think the problem is the ErrorReporter class. 
Something is failing there that is failing ACRA.

10-31 01:46:09.768: DEBUG/ACRA(9355): Retrieve application default 
SharedPreferences.
10-31 01:46:09.778: DEBUG/ACRA(9355): Set OnSharedPreferenceChangeListener.
10-31 01:46:09.788: DEBUG/ACRA(9355): ACRA is enabled for 
com.hourglass.applications, intializing...
10-31 01:46:09.838: WARN/ACRA(9355): com.hourglass.applications reports will be 
sent by email (if accepted by user).
10-31 01:46:09.848: ERROR/MyApplication()(9355): ACRA.init(this); crashes: null
10-31 01:46:09.858: ERROR/MyApplication()(9355): CONFIG: 
@org.acra.annotation.ReportsCrashes(additionalDropBoxTags=[], 
additionalSharedPreferences=[], customReportContent=[], 
deleteUnapprovedReportsOnApplicationStart=true, dropboxCollectionMinutes=5, 
forceCloseDialogAfterToast=false, formKey=, formUri=, 
formUriBasicAuthLogin=ACRA-NULL-STRING, 
formUriBasicAuthPassword=ACRA-NULL-STRING, includeDropBoxSystemTags=false, 
logcatArguments=[-t, 200, -v, time], mailTo=info@cupid-4-stupid.com, 
mode=NOTIFICATION, resDialogCommentPrompt=2131099688, resDialogEmailPrompt=0, 
resDialogIcon=17301543, resDialogOkToast=0, resDialogText=2131099687, 
resDialogTitle=0, resNotifIcon=2130837557, resNotifText=2131099685, 
resNotifTickerText=2131099683, resNotifTitle=2131099684, resToastText=0, 
sharedPreferencesMode=0, sharedPreferencesName=, socketTimeout=3000)
10-31 01:46:09.858: DEBUG/ACRA(9355): Retrieve application default 
SharedPreferences.
10-31 01:46:09.868: ERROR/MyApplication()(9355): SHARED PREFERENCES: 
android.app.ApplicationContext$SharedPreferencesImpl@446eedc8
10-31 01:46:09.868: WARN/System.err(9355): java.lang.NullPointerException
10-31 01:46:09.868: WARN/System.err(9355):     at 
org.acra.ErrorReporter.init(ErrorReporter.java:363)
10-31 01:46:09.868: WARN/System.err(9355):     at 
org.acra.ACRA.initAcra(ACRA.java:297)
10-31 01:46:09.878: WARN/System.err(9355):     at 
org.acra.ACRA.init(ACRA.java:238)
10-31 01:46:09.878: WARN/System.err(9355):     at 
com.hourglass.applications.MyApplication.onCreate(MyApplication.java:50)
10-31 01:46:09.878: WARN/System.err(9355):     at 
android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:969)
10-31 01:46:09.878: WARN/System.err(9355):     at 
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4165)
10-31 01:46:09.878: WARN/System.err(9355):     at 
android.app.ActivityThread.access$2900(ActivityThread.java:126)
10-31 01:46:09.878: WARN/System.err(9355):     at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1958)
10-31 01:46:09.878: WARN/System.err(9355):     at 
android.os.Handler.dispatchMessage(Handler.java:99)
10-31 01:46:09.878: WARN/System.err(9355):     at 
android.os.Looper.loop(Looper.java:123)
10-31 01:46:09.878: WARN/System.err(9355):     at 
android.app.ActivityThread.main(ActivityThread.java:4568)
10-31 01:46:09.888: WARN/System.err(9355):     at 
java.lang.reflect.Method.invokeNative(Native Method)
10-31 01:46:09.888: WARN/System.err(9355):     at 
java.lang.reflect.Method.invoke(Method.java:521)
10-31 01:46:09.888: WARN/System.err(9355):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
10-31 01:46:09.888: WARN/System.err(9355):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
10-31 01:46:09.888: WARN/System.err(9355):     at 
dalvik.system.NativeStart.main(Native Method)

Original comment by david.w....@gmail.com on 31 Oct 2011 at 5:52

GoogleCodeExporter commented 9 years ago
I managed to fix the problem! Or at least seems like I did:

By doing this, ACRA seems to not crash anymore:

ErrorReporter.getInstance().init(this);
ACRA.init(this);

Original comment by david.w....@gmail.com on 31 Oct 2011 at 7:42

GoogleCodeExporter commented 9 years ago
There should be a method added to ACRA which allow the developer to test ACRA 
and see if it does send information to the doc sheet, etc.

Original comment by david.w....@gmail.com on 31 Oct 2011 at 7:57