I am getting this crash log for my application:
java.lang.IllegalStateException
android.widget.ListView.layoutChildren(ListView.java:1544)
android.widget.AbsListView.onTouchModeChanged(AbsListView.java:3543)
android.view.ViewTreeObserver.dispatchOnTouchModeChanged(ViewTreeObserver.java:732)
android.view.ViewRootImpl.ensureTouchModeLocally(ViewRootImpl.java:3170)
android.view.ViewRootImpl.ensureTouchMode(ViewRootImpl.java:3154)
android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3397)
android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3347)
android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4456)
android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4434)
android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4538)
android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171)
android.os.MessageQueue.nativePollOnce(Native Method)
android.os.MessageQueue.next(MessageQueue.java:125)
android.os.Looper.loop(Looper.java:124)
android.app.ActivityThread.main(ActivityThread.java:4921)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
dalvik.system.NativeStart.main(Native Method)
But i can't see in this lines nothing that point to my code. any idea how i can detect the crash?
The way to get an IllegalStateException in ListView.layoutChildren() is to make the adapter item count differ from what the listview expected.
This can happen if you changed the data in your listview adapter but forgot to call notifyDataSetChanged(), or modified the data in a background thread.
Related
I have static values that are deleted after my application is a long time in the background or after opening many different apps, causing that my app crashes.
I think that Android OS is removing data from my app or "killing" it.
Is there any way to keep my app's data to avoid this problem?
NOTE: I can't save this values on SharedPreferences or in a database because there are many HashMaps and ArrayLists, is too much information.
It is necessary that these values are static because I need them available in many classes o my app in any time.
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.proyect/com.proyect.gui.ActivityMenu}: java.lang.NullPointerException: println needs a message
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2266)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2316)
at android.app.ActivityThread.access$600(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1298)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:5225)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException: println needs a message
at android.util.Log.println_native(Native Method)
at android.util.Log.v(Log.java:117)
at com.proyect.gui.FragmentMenu.onActivityCreated(FragmentMenu.java:145)
at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1983)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1092)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1234)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2046)
at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:174)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:597)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
at android.app.Activity.performStart(Activity.java:5143)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2239)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2316)
at android.app.ActivityThread.access$600(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1298)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:5225)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
Change this:
Log.v("errorTag", e.getMessage());
To this:
String error = e.getMessage();
if(error == null)
error = "It's crashed here";
Log.v("errorTag", error );
OR SIMPLER
Log.v("errorTag", e );
The point is that e.getMessage() is null. So, always check if e.getMessage() is not null before print it
In my Android application I have a dialog fragment that contains a ListView. The onclick handler of the items in the list view calls my internalPlayer method which calls a VideoView activity to play a video. The VideoView activity is used in other places within the app so I know it is working.
private void internalPlayer(final String channelUrl)
{
final Intent localIntent = new Intent(getActivity(), InternalVideoActivity.class);
localIntent.putExtra(EXTRA_VIDEO_URI, Uri.encode(channelUrl, ALLOWED_URI_CHARS).toString());
localIntent.putExtra(GridViewFragment.CHANNEL_NAME, mCategory.toString() + " Episode ");
getActivity().startActivity(localIntent);
}
When running the app in a tablet everything works well and the video activity starts and plays the video. When I run the app on a phone device when I click an item in the ListView the dialog fragment relaunches itself and because the serialized objects originally passed to it no longer exist there is a NullPointerException throw.
Here's the log:
04-16 19:34:33.790 6000-6000/com.xystra W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41998700)
04-16 19:34:33.790 6000-6000/com.xystra E/MAIN PHONE ACTIVITY: 1﹕ Unable to start activity ComponentInfo{com.xystra/com.xystra.activity.CatchUpSynopsisActivity}: java.lang.NullPointerException
04-16 19:34:33.814 6000-6000/com.xystra E/MAIN PHONE ACTIVITY﹕ STACK TRACE
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xystra/com.xystra.activity.CatchUpSynopsisActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3740)
at android.app.ActivityThread.access$700(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1262)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.xystra.ui.fragment.ProgramFragment.onCreateView(ProgramFragment.java:369)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1108)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1917)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:544)
at roboguice.activity.RoboFragmentActivity.onStart(RoboFragmentActivity.java:60)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
at android.app.Activity.performStart(Activity.java:5143)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3740)
at android.app.ActivityThread.access$700(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1262)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Any help or ideas are greatly appreciated.
More Info
The dialog fragment loads properly. The listview is populated everything is good.
When I click an item in the listview my internalPlayer method is called. When getActivity().startActivity(localIntent) is executed the dialog fragment relaunches itself instead of launching the new intent/activity.
Because the fragment is relaunching itself, the serialized objects that were originally passed the first time are not available or null so the dialog fragment returns the exception you see above.
Everything works perfectly on a tablet. Only on phone devices do I get this event.
Well I got rid of the dialog fragment and used the existing activity fragment for my view, ran some tests and was able to deduce that I had an arithmetic exception in an underlying activity for some reason that was causing the issue. Really don't know how that method got recalled to cause the exception. Thanks for all your help to those who commented.
My app accesses a webservice. I put in a search term and the app returns a list of articles relating to the search term i use. These articles are presented in listview. something very strange is happening and I have no idea what is going wrong. My app works perfectly when entering any search term. However, when i enter a very specific search term " ebola", a result returns, and is displayed in listview. However, when i click on an item in the listview, my app crashes. This only happens for this very specific search term and no other. It is really frustrating as my code obviously works but for some unknown reason not for this very particular search term.
StackTrace:
02-03 10:24:51.286 31560-31560/com.example.lifesci_pubmed W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41611d40)
02-03 10:24:51.288 31560-31560/com.example.lifesci_pubmed E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.lifesci_pubmed, PID: 31560
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.lifesci_pubmed/com.android.lifesci_pubmed.ArticlePagerActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2198)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257)
at android.app.ActivityThread.access$800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5086)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.android.lifesci_pubmed.ArticlePagerActivity.onCreate(ArticlePagerActivity.java:66)
at android.app.Activity.performCreate(Activity.java:5248)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2162)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257)
at android.app.ActivityThread.access$800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5086)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
The piece of code that is quoted as being responsible for the nullpointException:
String title = (String) getIntent().getStringExtra(ArticleFragment.EXTRA_TITLE);
for (int i = 0; i < articles.size(); i++) {
if (articles.get(i).getTitle().equals(title)) { // this line here
myViewPager.setCurrentItem(i);
I think articles.get(i).getTitle() returning null! Please provide the json you are receiving from the backend. Check for jsonException as well.
I have built a Android App thats has a WebView to show a mobile website within the app.
I have started to get this exception on one device particularly
This issue is not seen on other devices.
I went through the source code and it looks like an issue with Android. Can any one help me understand that if we can do anything else in the app to suppress this exception
Note: In the stack trace, there is nothing related to the app code
AndroidAppCrashDump {"brand":"samsung","model":"GT-S6312","sdk":16,"android":"4.1.2","appVersion":"1.1.15","manufacturer":"samsung"}----java.lang.ArrayIndexOutOfBoundsException: length=1; index=1109619192 at
java.util.Arrays.fill(Arrays.java:855) at
android.support.v4.widget.ViewDragHelper.clearMotionHistory(ViewDragHelper.java:773) at
android.support.v4.widget.ViewDragHelper.cancel(ViewDragHelper.java:499) at
android.support.v4.widget.ViewDragHelper.shouldInterceptTouchEvent(ViewDragHelper.java:1031) at
android.support.v4.widget.DrawerLayout.onInterceptTouchEvent(DrawerLayout.java:868) at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1877) at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2237) at
an droid.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1979) at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2237) at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1979) at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2237) at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1979) at
com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2177) at
com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1482) at
android.app.Activity.dispatchTouchEvent(Activity.java:2469) at
android.support.v7.app.ActionBarActivityDelegateICS$WindowCallbackWrapper.dispatchTouchEvent(ActionBarActivityDelegateICS.java:260) at
com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2125) at
android.view.View.dispatchPointerEvent(View.java:7414) at
android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3523) at
android.vi ew.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3455) at
android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4565) at
android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4543) at
android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4647) at
android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171) at
android.os.MessageQueue.nativePollOnce(Native Method) at
android.os.MessageQueue.next(MessageQueue.java:125) at
android.os.Looper.loop(Looper.java:124) at
android.app.ActivityThread.main(ActivityThread.java:4963) 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:1038) at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805) at
dalvik.system.NativeStart.main(Native Method)
I have an application published in Google play and some time ago i received two error reports in my developer console which looks just like this:
java.lang.IllegalArgumentException: Service not registered: org.OpenUDID.OpenUDID_manager#2b038438
at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:891)
at android.app.ContextImpl.unbindService(ContextImpl.java:921)
at android.content.ContextWrapper.unbindService(ContextWrapper.java:352)
at org.OpenUDID.OpenUDID_manager.onServiceConnected(OpenUDID_manager.java:68)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1064)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1081)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3701)
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:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
at dalvik.system.NativeStart.main(Native Method)
and second:
java.lang.IllegalArgumentException: Service not registered: org.OpenUDID.OpenUDID_manager#40590d88
at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:934)
at android.app.ContextImpl.unbindService(ContextImpl.java:952)
at android.content.ContextWrapper.unbindService(ContextWrapper.java:352)
at org.OpenUDID.OpenUDID_manager.onServiceConnected(OpenUDID_manager.java:68)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1107)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1124)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:4293)
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)
Can somebody explain me what is all this about? Non of the specified packages in stack trace are from my app.
Some of the libraries which i use are adcolony and appbooster. (I suppose that this libs might be the cause of problem).
Have a great new year 2014.if the answer is feasible than raise the answer and points :)
Hi i think i got the this problem please have a look.
Make sur you are using correct context.
one of these days
mService.unbindService(mConnection);
is obviously nonsense, calling unbind in the wrong context. It should be
unbindService(mConnection);
Additional mistake in the posted coding is the missing of
#Override
public boolean onUnbind(Intent intent) {
// All clients have unbound with unbindService()
return false;
}