Skip to content
This repository has been archived by the owner on Apr 19, 2018. It is now read-only.

ArrayIndexOutOfBoundsException occurs randomly when starting an Activity with ABS #564

Closed
atermenji opened this issue Aug 2, 2012 · 3 comments

Comments

@atermenji
Copy link

I am writing an application with several SherlockFragmentActivities for open-source Catroid project
There is a test project for this application to test UI. It has nearly 150 test cases which are using Robotium to test the behavior. The test project is running daily on Jenkins.
The problem is that sometimes random ArrayIndexOutOfBoundsExceptions occur in different tests when running test project on Jenkins. The stack trace is always the same:

08-02 01:31:53.480 E/AndroidRuntime( 8486): FATAL EXCEPTION: main 08-02 01:31:53.480 E/AndroidRuntime( 8486): android.view.InflateException: Binary XML file line #17: Error inflating class <unknown> 08-02 01:31:53.480 E/AndroidRuntime( 8486): at android.view.LayoutInflater.createView(LayoutInflater.java:518) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at android.view.LayoutInflater.inflate(LayoutInflater.java:386) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at com.actionbarsherlock.internal.view.menu.BaseMenuPresenter.createItemView(BaseMenuPresenter.java:155) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at com.actionbarsherlock.internal.view.menu.BaseMenuPresenter.getItemView(BaseMenuPresenter.java:174) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at com.actionbarsherlock.internal.view.menu.ActionMenuPresenter.getItemView(ActionMenuPresenter.java:187) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at com.actionbarsherlock.internal.view.menu.ActionMenuPresenter.flagActionItems(ActionMenuPresenter.java:460) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at com.actionbarsherlock.internal.view.menu.MenuBuilder.flagActionItems(MenuBuilder.java:1048) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at com.actionbarsherlock.internal.view.menu.BaseMenuPresenter.updateMenuView(BaseMenuPresenter.java:89) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at com.actionbarsherlock.internal.view.menu.ActionMenuPresenter.updateMenuView(ActionMenuPresenter.java:215) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at com.actionbarsherlock.internal.view.menu.MenuBuilder.dispatchPresenterUpdate(MenuBuilder.java:247) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at com.actionbarsherlock.internal.view.menu.MenuBuilder.onItemsChanged(MenuBuilder.java:946) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at com.actionbarsherlock.internal.view.menu.MenuBuilder.startDispatchingItemsChanged(MenuBuilder.java:969) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at com.actionbarsherlock.internal.ActionBarSherlockCompat.preparePanel(ActionBarSherlockCompat.java:524) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at com.actionbarsherlock.internal.ActionBarSherlockCompat.dispatchInvalidateOptionsMenu(ActionBarSherlockCompat.java:273) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at com.actionbarsherlock.internal.ActionBarSherlockCompat$1.run(ActionBarSherlockCompat.java:988) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at android.os.Handler.handleCallback(Handler.java:587) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at android.os.Handler.dispatchMessage(Handler.java:92) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at android.os.Looper.loop(Looper.java:130) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at android.app.ActivityThread.main(ActivityThread.java:3683) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at java.lang.reflect.Method.invokeNative(Native Method) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at java.lang.reflect.Method.invoke(Method.java:507) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at dalvik.system.NativeStart.main(Native Method) 08-02 01:31:53.480 E/AndroidRuntime( 8486): Caused by: java.lang.reflect.InvocationTargetException 08-02 01:31:53.480 E/AndroidRuntime( 8486): at java.lang.reflect.Constructor.constructNative(Native Method) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at java.lang.reflect.Constructor.newInstance(Constructor.java:415) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at android.view.LayoutInflater.createView(LayoutInflater.java:505) 08-02 01:31:53.480 E/AndroidRuntime( 8486): ... 25 more 08-02 01:31:53.480 E/AndroidRuntime( 8486): Caused by: java.lang.ArrayIndexOutOfBoundsException 08-02 01:31:53.480 E/AndroidRuntime( 8486): at com.actionbarsherlock.internal.ResourcesCompat.getResources_getBoolean(ResourcesCompat.java:53) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at com.actionbarsherlock.internal.view.menu.ActionMenuItemView.<init>(ActionMenuItemView.java:74) 08-02 01:31:53.480 E/AndroidRuntime( 8486): at com.actionbarsherlock.internal.view.menu.ActionMenuItemView.<init>(ActionMenuItemView.java:68) 08-02 01:31:53.480 E/AndroidRuntime( 8486): ... 28 more 08-02 01:31:53.488 I/Process ( 106): Sending signal. PID: 8486 SIG: 9 08-02 01:31:53.488 W/ActivityManager( 106): Error in app at.tugraz.ist.catroid running instrumentation ComponentInfo{at.tugraz.ist.catroid.uitest/pl.polidea.instrumentation.PolideaInstrumentationTestRunner}: 08-02 01:31:53.488 W/ActivityManager( 106): java.lang.ArrayIndexOutOfBoundsException 08-02 01:31:53.488 W/ActivityManager( 106): java.lang.ArrayIndexOutOfBoundsException: Binary XML file line #17: Error inflating class <unknown>

The stack trace points to some internal ABS problem. Probably options menu is not inflated correctly in some cases but I don't know what exactly causes this issue.

@atermenji
Copy link
Author

sometimes this exception appears in setHasOptionsMenu(true) method and leads to the same stack trace.

atermenji added a commit to atermenji/ActionBarSherlock that referenced this issue Aug 6, 2012
@JakeWharton
Copy link
Owner

This exception makes no sense. I don't think there's really anything to be done, sorry. At the very least it seems related to how aapt is generating the R file. Or maybe proguard screwing it up somehow. Really hard to say.

@atermenji
Copy link
Author

I guess, you are right, thanks for the help

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants