saravanarajan / acra

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

Nullpointer exception when trying to retrieve crash data #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
====================================================
I implemented your lib in my application, following howto2. I intentionally
create a nullpointerexception to test the lib.

What is the expected output? What do you see instead?
====================================================
The crash report doesn't show up in google docs, instead my app/acra throws
a null pointer exception here:
[...]
05-24 17:01:37.354: ERROR/ACRA(7398): Error while retrieving crash data
        java.lang.NullPointerException
        at java.util.Hashtable.put(Hashtable.java:369)
        at org.acra.ErrorReporter.retrieveCrashData(ErrorReporter.java:284)
        at org.acra.ErrorReporter.handleException(ErrorReporter.java:399)
        at org.acra.ErrorReporter.uncaughtException(ErrorReporter.java:331)
        at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:887)
        at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:884)
        at dalvik.system.NativeStart.main(Native Method)
05-24 17:01:37.374: DEBUG/ACRA(7398): Writing crash report file.
05-24 17:01:37.394: DEBUG/ACRA(7398): Looking for error files in
/data/data/com.myapp.android/files
05-24 17:01:37.404: DEBUG/ACRA(7398): Connect to
http://spreadsheets.google.com/formResponse?formkey=abcMZVV4MmZVZWxGZzNuSWRELXA5
UVE6MQ&abc
05-24 17:01:37.564: DEBUG/ACRA(7398): Posting crash report data
05-24 17:01:37.564: DEBUG/ACRA(7398): Reading response
[...]

What version of the product are you using? On what operating system?
====================================================
Nexus One, Android 2.2 (Froyo)

Please provide any additional information below.
====================================================
When I first run my app after I implemented the acra, the communication to
the google docs seem to work fine. I actually got an exception reported
there, although it was not thrown by my app, but from the acra package:

java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.alocaly.crashreport/com.alocaly.crashreport.CrashTestActivity}
:
java.lang.NullPointerException
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
    at android.app.ActivityThread.access$2200(ActivityThread.java:119)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:123)
    at android.app.ActivityThread.main(ActivityThread.java:4363)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:521)
    at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
    at
com.alocaly.crashreport.CrashTestActivity.onCreate(CrashTestActivity.java:17)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
    ... 11 more
java.lang.NullPointerException
    at
com.alocaly.crashreport.CrashTestActivity.onCreate(CrashTestActivity.java:17)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
    at android.app.ActivityThread.access$2200(ActivityThread.java:119)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:123)
    at android.app.ActivityThread.main(ActivityThread.java:4363)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:521)
    at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
    at dalvik.system.NativeStart.main(Native Method)

Original issue reported on code.google.com by mathias....@gmail.com on 24 May 2010 at 9:10

GoogleCodeExporter commented 9 years ago
btw: I also now tested the 1.2.1 lib, but with the same result.

Original comment by mathias....@gmail.com on 24 May 2010 at 9:29

GoogleCodeExporter commented 9 years ago
The first line in your Google Docs spreadsheet is a "sample" line included in 
the 
.csv.
I will do some tests to see if it is mandatory or not to allow the automatic 
creation 
of the Form. If it is not, I will remove it because other testers thought this 
line 
was reported by their app.

The Error while retrieving crash data is strange because it looks like ACRA did 
not 
manage to retrieve your application's crash info.

Could you please give more details on where you put your intentional 
NullPointerException so that I might try to reproduce ? Without this, all I can 
fix 
is to test the case where PackageInfo is null and send the stack trace without 
your 
application version and package names.

Original comment by kevin.gaudin on 24 May 2010 at 12:34

GoogleCodeExporter commented 9 years ago

Original comment by kevin.gaudin on 24 May 2010 at 12:34

GoogleCodeExporter commented 9 years ago
I added the nullpointer in one of my activities (not the main activity but one 
that I
reach later when clicking on a button somewhere in another activity), in the 
onCreate
method:

        @Override
    public void onCreate(Bundle icicle) {
      super.onCreate(icicle);
          txtQuestion.setText("asd");
          ...

where txtQuestion is definitely null there since it hasn't been read.

Original comment by mathias....@gmail.com on 24 May 2010 at 12:38

GoogleCodeExporter commented 9 years ago
btw: the class that extends org.acra.CrashReportingApplication and holds the
getFormId is in my package under: com.myappname.android.MyAppName
Is that right or doesn it need to be at the very root? Like on the same level 
of com ?

Original comment by mathias....@gmail.com on 24 May 2010 at 12:41

GoogleCodeExporter commented 9 years ago
You can extend CrashReportingApplication in any package. All you have to do is 
rerefence the class name in the <application> tag of your AndroidManifest.xml. 
If the 
Application class package is different from the package declared as the root of 
your 
manifest (<manifest package="com.myappname.android"), you might just have to 
reference your application object name with its full package included 
(<application 
name="com.different.package.MyApplication">).

Please try again with the version of ACRA attached to this comment.

It retrieves application data a safer way and should anyway send the report. In 
your 
case (I still don't understand why), you might not get your application version 
name 
in the report. This is still to be investigated, the application version is an 
important data to debug crash reports.

Could you send me by mail your application manifest ?

Original comment by kevin.gaudin on 24 May 2010 at 1:12

Attachments:

GoogleCodeExporter commented 9 years ago
Alright, some new hints: 

1)
I tried some crashes with my NexusOne via Wifi at home and with my vpn on and 
off.
Since I'm in China and Google spreadsheet is sometimes blocked by the 
GreatFireWall
(getting 'connection resets'), that seems to be the reason why the reports 
didn't get
posted in the spreadsheet. Actually with vpn turned off on my NexusOne but on 
on my
PC though (which connects to the Nexus One in debug mode), it works ok and the 
crash
reports get posted.

2)
Nevertheless, even with the successful posting of the crash report now, the 
logcat
still logs the NullPointerException 
ERROR/ACRA(7398): Error while retrieving crash data
        java.lang.NullPointerException
a few lines above.

Original comment by mathias....@gmail.com on 24 May 2010 at 1:17

GoogleCodeExporter commented 9 years ago
Reproduced and fixed. This happens if not using the android:versionName 
attribute of 
the manifest tag.

Version 2.0.2 now available with the fix.

Original comment by kevin.gaudin on 24 May 2010 at 2:03