I have ocassional crash at my emulator, but for now never on tablet on which I am testing.
java.util.ConcurrentModificationException
at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(LinkedHashMap.java:346)
at java.util.LinkedHashMap$EntryIterator.next(LinkedHashMap.java:375)
at java.util.LinkedHashMap$EntryIterator.next(LinkedHashMap.java:373)
at java.util.HashMap.writeObject(HashMap.java:1024)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1229)
at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1215)
at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1587)
at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1859)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1701)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1665)
at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:1153)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:420)
at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1251)
at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1587)
at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1859)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1701)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1665)
at android.os.Parcel.writeSerializable(Parcel.java:1155)
at android.os.Parcel.writeValue(Parcel.java:1114)
at android.os.Parcel.writeMapInternal(Parcel.java:479)
at android.os.Bundle.writeToParcel(Bundle.java:1552)
at android.os.Parcel.writeBundle(Parcel.java:493)
at android.app.ActivityManagerProxy.activityPaused(ActivityManagerNative.java:1574)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3292)
at android.app.ActivityThread.access$2500(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2040)
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)
It seems from the log it happens when the activity is going to pause.
All my activity are accessing a common super class static object (global data), which indeed has some linkedhashmap inside, and I am saving this globaldata with putSerializable inside onSaveInstanceState. I have tried to put save/restore of globaldata inside my base activity class inside sattic synchronized methods, but it didn't helped.
My I know from yours experiences if this is some internal android bug (maybe just emulator bug) or If I am managing saving of global data (which has LinkedHashMap inside) wrong. Or is there another way to share common data between activites?
Thanks
Related
My app is getting crash reports on google play. I was told that android can release your memory on you, is this really true.
I'm getting a NullPointerException error on the following line
if (butSettings.Intersect(x, y))
I'm assuming butSettings is null.
I'm confuse because butsettings is set up on the onCreate. It's member functions are then called on the onUpdate which gets called every .1 of a second.
line
if (butSettings.Intersect(x, y))
is in my onTouch event. So I'm assuming butSettings member functions would have gotten called in the onDraw. So why is this truing into a null?? Could android being freeing it?
stack trace from google
java.lang.NullPointerException
at com.fairhvaenapps.toddpuzzlefree.cMainView.onTouchEvent(cMainView.java:267)
at android.view.View.dispatchTouchEvent(View.java:5588)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1684)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1684)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1684)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2060)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1398)
at android.app.Activity.dispatchTouchEvent(Activity.java:2364)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2008)
at android.view.View.dispatchPointerEvent(View.java:5768)
at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:2911)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2485)
at android.view.ViewRootImpl.processInputEvents(ViewRootImpl.java:852)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2494)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4514)
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:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
Android can destroy your activity at any moment, that's why you have to properly do initialization in onCreate and properly dispose of things in onDestroy. However, you will never end up with a NullPointerException because of this; Android will not just simply remove a reference to an object because of this. The exception you're seeing is because of some bug in your code. It has nothing to do with memory.
In my android app I am using AsyncTask. It was working perfectly but from last 2 days my app crashed when I called .execute() of AsyncTask. The error is:
FATAL EXCEPTION: main
java.lang.NullPointerException
at android.os.AsyncTask.execute(AsyncTask.java:378)
at com.riksof.a320.remote.RemoteObject.update(RemoteObject.java:117)
at com.fitmo.controller.activity.FitmoEditActivityDetailController.updateActivityDate(FitmoEditActivityDetailController.java:64)
at com.fitmo.controller.activity.FitmoEditActivityDetailController.access$0(FitmoEditActivityDetailController.java:51)
at com.fitmo.controller.activity.FitmoEditActivityDetailController$1.onClick(FitmoEditActivityDetailController.java:45)
at android.view.View.performClick(View.java:2532)
at android.view.View$PerformClick.run(View.java:9293)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:143)
at android.app.ActivityThread.main(ActivityThread.java:4263)
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:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
When I saw the code inside AsyncTask.java, I found this code inside AsyncTask constructor:
switch (mStatus)
So I debug the AsyncTask status by calling getStatus() method of AsyncTask before calling execute() and the value is null here as well. What can be the reason for this any ideas ?
I am not getting this every time. Some times it works properly sometimes it doesn't.
Did you remove the AsyncTask myTask = new AsyncTask() by accident?
The code: http://pastebin.com/5bhKULGd
the problem:
When you click an item in the gridview, OCLGenre (OnItemClickListener for Genre view)
fires an nullPointer at line 123. I'm trying to understand where the nullPointer comes from but can't find it.
The stack:
ERROR/AndroidRuntime(10511): FATAL EXCEPTION: main
java.lang.NullPointerException
at com.MMWeb.MMWeb$browse$1.onItemClick(MMWeb.java:123)
at android.widget.AdapterView.performItemClick(AdapterView.java:284)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:1812)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3683)
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:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
Anyone got a pointer to where to find the source of this nullPointer?
If you try to access an object which is null. Like the below example.
ClassA objA;
At this time you have just declared this object but you have not initialized or instantiated it.
When you try to access any property or method in it, it will throw
NullPointerException.
Oke i found my problem By moving the ImageAdapter out of the "browse" class, the "browse" class did not have any reference to the ArrayList 'items'. I could find the problem because, after all, i defined the ArrayList at line 112. However, showGenres() uses a local ArrayList, and the ImageAdapter would put it in "browser.items". Fixed it by removing the local decleration of items on line 145, 154 and 162
Does anyone know what this could possibly mean? Apparently someone else's app caused mine to crash? And it happens to be an app that directly competes with mine:
java.lang.RuntimeException: Unable to create BackupAgent com.MY_COMPEITOR'S_APP.backup.BackupAgent: java.lang.NullPointerException
at android.app.ActivityThread.handleCreateBackupAgent(ActivityThread.java:2905)
at android.app.ActivityThread.access$4000(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2128)
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:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at android.app.ActivityThread$PackageInfo.initializeJavaContextClassLoader(ActivityThread.java:529)
at android.app.ActivityThread$PackageInfo.getClassLoader(ActivityThread.java:474)
at android.app.ActivityThread.handleCreateBackupAgent(ActivityThread.java:2873)
... 10 more
TenFour I would bet since you are talking about a competing App that there must be some INtent Handling going on that led to this. Maybe the Competitor app was actually trying to do something at the same time your app was trying to do something and they clashed. Without knowing more it's hard to provide a more detailed answer
I followed the advice given on the internet regarding working with Application classes in android.
I also added a field "android:name=.Session" to my Application object in the manifest.
The application is called "Session".
What do you think is the error? This is happening even before the my App starts.
This is the error stack:
**java.lang.RuntimeException: Unable to instantiate application com.appfire.Session: java.lang.InstantiationException: com.appfire.Session**
at android.app.ActivityThread$PackageInfo.makeApplication(ActivityThread.java:523)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3996)
at android.app.ActivityThread.access$2900(ActivityThread.java:119)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1901)
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.InstantiationException: com.appfire.Session**
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1479)
at android.app.Instrumentation.newApplication(Instrumentation.java:957)
at android.app.Instrumentation.newApplication(Instrumentation.java:942)
at android.app.ActivityThread$PackageInfo.makeApplication(ActivityThread.java:518)
Make sure your Session class is public, is not static, and does not have a default constructor.
public class Session extends Application {}
In the Manifest application tag, make sure you include the fully-qualified class name of your custom Application object:
<application
android:name="com.mycompany.myapp.Session"
.... />
The Android docs do say the class name must be fully qualified:
http://developer.android.com/guide/topics/manifest/application-element.html#nm
(This is not the case for Activity class names that are included in the activity tag of the Manifest. Those can be relative, preceded with a '.').
My solution was to delete the whole project from Eclipse and load it again from SVN. Now it works