I have an app on Google play. I got a few error reports from the developer page and It's quite hard to figure out the problem.
This is what I have:
java.lang.NullPointerException
at com.seb.example.free.MainActivity$ApplyFilter.onPostExecute(MainActivity.java:828)
at com.seb.example.free.MainActivity$ApplyFilter.onPostExecute(v.java:1)
at android.os.AsyncTask.finish(AsyncTask.java:631)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:4987)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
at dalvik.system.NativeStart.main(Native Method)
As you can see I have an asynctask innerclass and the error seems to be in on postexecute.
I have checked my project in eclipse and, as the stacktrace says, the error is on line 828:
(iV.getVisibility() == ImageView.INVISIBLE)
My imageView, iV, is declared as private in MainActivity and I initiate it in oncreate.
I can't reproduce the problem on the three of my phones as i have tested on, so it's quite hard to understand what's causing it.
Anyone who has any ideas? Thanks!
I think that imageview object is becomes null in some where in your code..check whether it initialized or not..and if initialized check where it is used in your project.
It might have been derefferenced in some other place, initialize in onresume and see whether this persists or not.
please check have you initialized iv
try:
if(iv != null)
(iV.getVisibility() == View.INVISIBLE)
else
Log.e("CHECK","iv Null");
if you have not initialized iv then do that first.
Related
The app crashes in setParametersFromIntent which is called in onCreate of the activity. The method throws a custom RumtimeException if a specific intent extra is not set.
The crash is only reported rarely, I was not able to reproduce the bug.
I checked the code and there seems to be no possible route the activity could be started without the parameter being set.
Caused by java.lang.RuntimeException: intent extra not set
at com.myapp.myapp.activities.MyActivity.setParametersFromIntent(MyActivity.java)
at com.myapp.myapp.activities.MyActivity.onCreate(MyActivity.java)
at android.app.Activity.performCreate(Activity.java:5442)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2393)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2493)
at android.app.ActivityThread.access$800(ActivityThread.java:166)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5584)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(NativeStart.java)
I read that upon recreation of an activity, the intent extras are also restored, so I rule that out as a possible cause.
Does the log give any hints about how the activity has been started?
The android.app.Instrumentation.callActivityOnCreate also seems suspicious, as instrumentation should be disabled in the released app. Could this be someone trying to analyze and mess around with the activity, causing this exception?
I'm trying to learn and add some basic Facebook functionality to my Android App (an address book). What I'm eventually going to do is import a friends profile picture. I've currently only copy/pasted what I need from the "FriendPickerSample" example project, which is just a button that brings up a friend picker fragment, and, if I remember correctly, it places the names you picked into a list. I've altered it to come up when an imageview is clicked, and it'll just Toast the single name that is chosen. When I try to bring up the friend picker, I get a null pointer exception, and I don't understand why. Here's the log:
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.JDE.RAB/com.JDE.RAB.PickFriendsActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
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:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.facebook.widget.PickerFragment.onCreateView(PickerFragment.java:152)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:871)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1083)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:635)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1431)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:523)
at com.JDE.RAB.PickFriendsActivity.onStart(PickFriendsActivity.java:112)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1129)
at android.app.Activity.performStart(Activity.java:3781)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2636)
... 11 more
This is the code in my onclick, which is supposed to open the PickFriendsActivity:
if (Session.getActiveSession() == null || Session.getActiveSession().isClosed())
{
Session.openActiveSession(AddNewTabLayoutActivity.this, true, null);
}//endif
FriendPickerApplication application = (FriendPickerApplication) GetMyApplication();
application.setSelectedUsers(null);
Intent intent = new Intent(AddNewTabLayoutActivity.this, PickFriendsActivity.class);
// Note: The following line is optional, as multi-select behavior is the default for
// FriendPickerFragment. It is here to demonstrate how parameters could be passed to the
// friend picker if single-select functionality was desired, or if a different user ID was
// desired (for instance, to see friends of a friend).
//multi-select is OFF
PickFriendsActivity.populateParameters(intent, null, false, true);
Debugger.SendNotification(getApplicationContext(), "Alert", "Alert", "Starting Activity For Result", 3009);
startActivityForResult(intent, 2);
PickFriendsActivity, line 112 is super.onStart(); Should I post the entirety of that activities source code?
Thanks for any help!
You should copy res/layout/pick_friends_activity.xml to your own project too.
I wish I had more information about this error but I just don't. I have a tool called BugSense(Now it is Splunk MINT) that sends crashes to a remote server and this is all I'm getting:
java.lang.NullPointerException
at android.view.HardwareRenderer$GlRenderer.checkCurrent(HardwareRenderer.java:960)
at android.view.HardwareRenderer$Gl20Renderer.destroyLayers(HardwareRenderer.java:1148)
at android.view.ViewRootImpl.destroyHardwareResources(ViewRootImpl.java:576)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:973)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2448)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4482)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
at dalvik.system.NativeStart.main(Native Method)
The interesting thing is that all of the error instances came from:
BLU DASH 4.0
They are all rooted
They all had Mobile Net turned off
They all had at least 12 running apps
So... what do you think?
has anyone had a NPE in the HardwareRenderer class?
Could it be a 'root' thing (i.e. an issue with the device being rooted)?
Could it be a 'hardware' thing (i.e. an issue with the BLUE DASH 4.0)
The problem is that the code is using an null object.
MyClass class;
class.doStuff(); // Will throw NullPointerException as class is null
MyClass newClass = new MyClass();
newClass.doStuff(); // Will work as newClass is pointing to an object.
As I do not have the offending code, I cannot help further. I would suggest you include the code at (HardwareRenderer.java:960), and the call route from the stack, as this is what is causing the exception.
I'm having a bit of trouble getting Async to work correctly. I have my doInBackground passing a string of a JSON response, which my onPostExecute will parse and then send to the view, but I keep getting a null pointer for my onPostExecute. I know that it's getting a proper response back because my Log prints the JSON string I'm expected.
Am I not passing something correctly?
Here's my stacktrace:
07-07 13:26:33.757: ERROR/AndroidRuntime(5714): FATAL EXCEPTION: main
java.lang.NullPointerException
at com.dsgunter.randompokemongenerator.Generator$LoadPokemon.onPostExecute(Generator.java:153)
at com.dsgunter.randompokemongenerator.Generator$LoadPokemon.onPostExecute(Generator.java:113)
at android.os.AsyncTask.finish(AsyncTask.java:631)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5021)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
and my code, which I'll post in a gist for brevity's sake:
https://gist.github.com/verkaufer/88eeb44a0997a4a49779
The problem is at progressDialog.dismiss(). That progressDialog variable is null. You created a pDialog local to the onPreExecute method above that, which is what I think you really want to be dismissing.
Your progressDialog variable looks to never be initialized, so it is null. And this line
progressDialog.dismiss();
then throws NPE because of that.
You never initialize progressDialog, so it is null. I guess you want to dismiss the dialog created in onPreExecute, so add this line:
progressDialog = pDialog;
I have a crash report from a user which i couldn't recreate same error myself on my test device.
Here is the relevant code :
for(File f : sessionDirectory.listFiles()){
Date lastModDate = new Date(f.lastModified());
/*Line 53*/ Session ss = new Session(lastModDate.toLocaleString() , f.getName()) ;
sessionArrayList.add(ss ) ;
}
and here are the stack traces :
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mydomain/com.mydomain.myActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2787)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2803)
at android.app.ActivityThread.access$2300(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2136)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:144)
at android.app.ActivityThread.main(ActivityThread.java:4937)
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:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.mydomain.myActivity.onCreate(myActivity.java:53)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1069)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2751)
I have seen things like that when concerting dates to/from string representations in java (not android) and for a long time didn't have a clue why. I don't remember the exact details, but it had something to do with a conversion method not being thread safe, which was weird, because (if I remember correctly) it happened in a call to a static jdk method.
Try if it still happens when you pull lastModDate.toLocaleString() into a synchronized method and using an instance of DateFormat.
There was already a bug file against this in the jdk when I looked for it, but it was rejected.
(Perhaps toLocaleString uses a DateFormat attached to the current locale which is shared between all threads, and calls a non-threadsafe method.)
However this is just a guess, but since the symptoms are similarly weird, just give it a try.
Stack trace says:
Caused by:
java.lang.NullPointerException at
com.mydomain.myActivity.onCreate(myActivity.java:53)
What is line 53?
sessionDirectory can be null and sessionDirectory.listFiles() can return null - also got reminded of that by a user crash report :-)