What is the cause of an IllegalArgumentException at onRestoreInstanceState - android

There was multiple (more than 10) crashes reported in my Google Play Console with this stack trace (full):
java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
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:0)
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:0)
Caused by: java.lang.IllegalArgumentException:
at android.view.View.onRestoreInstanceState(View.java:12308)
at android.view.View.dispatchRestoreInstanceState(View.java:12284)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2617)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2623)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2623)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2623)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2623)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2623)
at android.view.View.restoreHierarchyState(View.java:12262)
at com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:1647)
at android.app.Activity.onRestoreInstanceState(Activity.java:938)
at android.app.Activity.performRestoreInstanceState(Activity.java:910)
at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1138)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2189)
What would trigger this exception? There was no mention of my application's classes in the stack trace. What should I do?

The following text is written in the Android source code in View.java:12308 as the IllegalArgumentException message:
Wrong state class, expecting View State but received (something else) instead. This usually happens when two views of different type have the same id in the same hierarchy. This view's id is (view id). Make sure other views do not use the same id.

Related

Security Exception with AccountManager

I'd like to create an account in my Android app programatically.
I've read thing about the AccountManager class and tried to implement it.
Unfortunately, I get a SecurityException when I try to add the account.
Account account = new Account(user.getLogin(), 'packageName');
The thing I don't understand is about the type (in the second parameter).
What do I've to put in second parameter in order to make my code working.
Moreover, I'd like to know if I can add an acount simply with theses lines of code, or should I use a service like many example show ?
Thanks
EDIT - Full Exception Message
java.lang.SecurityException: caller uid 10047 is different than the authenticator's uid
at android.os.Parcel.readException(Parcel.java:1425)
at android.os.Parcel.readException(Parcel.java:1379)
at android.accounts.IAccountManager$Stub$Proxy.addAccount(IAccountManager.java:580)
at android.accounts.AccountManager.addAccountExplicitly(AccountManager.java:565)
at fr.opendev.elisaG.activity.LoginActivity.isUserAuthorized(LoginActivity.java:113)
at fr.opendev.elisaG.activity.LoginActivity.access$500(LoginActivity.java:27)
at fr.opendev.elisaG.activity.LoginActivity$1.onClick(LoginActivity.java:70)
at android.view.View.performClick(View.java:4084)
at android.view.View$PerformClick.run(View.java:16964)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)

Osmand build crash on debug

I imported the latest master folder (master branch 26-12-2014) to Android-Studio,Gradle build the project successfully after little fix (asset missing,inner fragment static error) then i launched the debugger on my device (samsung galaxy 3 min,Android 4.1.2),I expect to have Osmand running on my device but the application crashes and the log indicate that it happen on getting routing.xml file.
12-26 10:47:10.069 10508-10508/net.osmand.plus E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to create application net.osmand.plus.OsmandApplication: java.lang.IllegalStateException: java.lang.IllegalArgumentException
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4200)
at android.app.ActivityThread.access$1400(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4867)
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:1007)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: java.lang.IllegalArgumentException
at net.osmand.router.RoutingConfiguration.getDefault(RoutingConfiguration.java:171)
at net.osmand.plus.helpers.AvoidSpecificRoads.getBuilder(AvoidSpecificRoads.java:44)
at net.osmand.plus.helpers.AvoidSpecificRoads.<init>(AvoidSpecificRoads.java:38)
at net.osmand.plus.OsmandApplication.onCreate(OsmandApplication.java:168)
Thanks.
Make sure that there is a folder named "router" inside your "OsmAnd/scr/net/osmand/" folder which contains the routing.xml file.
If not you can find the resources needed here

Android - crash occurs but the stack trace does not say where it happened

I have a null pointer exception somewhere, but I am not sure where. All I have is this error:
java.lang.NullPointerException
at android.widget.ArrayAdapter.getCount(ArrayAdapter.java:330)
at android.widget.AdapterView.checkFocus(AdapterView.java:700)
at android.widget.AdapterView$AdapterDataSetObserver.onInvalidated(AdapterView.java:823)
at android.widget.AbsListView$AdapterDataSetObserver.onInvalidated(AbsListView.java:5738)
at android.database.DataSetObservable.notifyInvalidated(DataSetObservable.java:47)
at android.widget.BaseAdapter.notifyDataSetInvalidated(BaseAdapter.java:59)
at android.widget.ArrayAdapter$ArrayFilter.publishResults(ArrayAdapter.java:513)
at android.widget.Filter$ResultsHandler.handleMessage(Filter.java:282)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4697)
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)
Would anyone have any ideas for how to debug this? I have not been able to reproduce it. It just sometimes happens and shows up in my crash logs.
Thanks!
Here's the code for ArrayAdapter: https://github.com/android/platform_frameworks_base/blob/master/core/java/android/widget/ArrayAdapter.java.
Assuming this is the right version, an NPE on line 330 would be caused if the adapter's dataset (i.e. the backing list or array) is null.
Hope that helps.

getting stragne unexpected error sometime using ActionBarSherlock

I am using ActionBarShelock and some time get force close with this error cant find how to handle it .
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sps/com.sps.ui.activities.HomeActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at android.support.v4.app._ActionBarSherlockTrojanHorse.onCreatePanelMenu(_ActionBarSherlockTrojanHorse.java:52)
at com.actionbarsherlock.ActionBarSherlock.callbackCreateOptionsMenu(ActionBarSherlock.java:556)
at com.actionbarsherlock.internal.ActionBarSherlockNative.dispatchCreateOptionsMenu(ActionBarSherlockNative.java:60)
at com.actionbarsherlock.app.SherlockFragmentActivity.onCreatePanelMenu(SherlockFragmentActivity.java:154)
at com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java:393)
at com.android.internal.policy.impl.PhoneWindow.invalidatePanelMenu(PhoneWindow.java:747)
at com.android.internal.policy.impl.PhoneWindow.restorePanelState(PhoneWindow.java:1677)
at com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:1627)
at android.app.Activity.onRestoreInstanceState(Activity.java:928)
at android.app.Activity.performRestoreInstanceState(Activity.java:900)
at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1130)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2037)
... 11 more
In the r7 support library, the version on which the current release (4.1.0) of ActionBarSherlock is based, the FragmentManager class checked if mActive != null before dispatching menu events to the fragments contained in the mAdded list. This code was copied into ActionBarSherlock since it uses its own MenuItem type and does its own dispatching.
In a subsequent release of the support library, it was found that this check was no longer representative of whether or not mAdded had been instantiated with a list or not. Commit 464b6f3c changed the conditional check to mAdded != null.
ActionBarSherlock has not had a release since this fix was made. However, it was updated on the dev branch in commit 69fe6fd to be included in the next release.

exception log in Android Market Place

I'm seeing this exception in my android Market Developer Console -->Crash errors
java.lang.NullPointerException
at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:398)
at android.widget.ArrayAdapter.getView(ArrayAdapter.java:366)
at android.widget.AbsListView.obtainView(AbsListView.java:1943)
at android.widget.ListPopupWindow$DropDownListView.obtainView(ListPopupWindow.java:1143)
at android.widget.ListView.makeAndAddView(ListView.java:1756)
at android.widget.ListView.fillDown(ListView.java:656)
at android.widget.ListView.fillSpecific(ListView.java:1314)
at android.widget.ListView.layoutChildren(ListView.java:1587)
at android.widget.AbsListView.onLayout(AbsListView.java:1794)
at android.view.View.layout(View.java:9330)
at android.view.ViewGroup.layout(ViewGroup.java:3795)
at android.widget.FrameLayout.onLayout(FrameLayout.java:400)
at android.view.View.layout(View.java:9330)
at android.view.ViewGroup.layout(ViewGroup.java:3795)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1201)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1944)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:126)
at android.app.ActivityThread.main(ActivityThread.java:3998)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:491)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
at dalvik.system.NativeStart.main(Native Method)
Here are the things which i don't understand about this error:
Where is it coming from (i don't see any reference to my classes in this trace)?
Does it mean the application shuts down because of this errors?
What is the mechanism by which this error gets logged in market place?
Note : there are no user messages in the error log.
Looks like either it expects a TextView in your layout which is not there, or an item in your list is null. The relevant source is at http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.3.5_r1/android/widget/ArrayAdapter.java#ArrayAdapter.createViewFromResource%28int%2Candroid.view.View%2Candroid.view.ViewGroup%2Cint%29, line 398 corresponds to line 355 on this page.

Categories

Resources