Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crash with Android 4.1 with ArrayMap

I get an error in my code with this logcat:

java.lang.NoClassDefFoundError: android.util.ArrayMap
at it.dd.multiplayerit.MainActivity.<init>(MainActivity.java:88)
at it.dd.multiplayerit.SwipeMainFragment$SectionsPagerAdapter.getItem(SwipeMainFragment.java:200)
at android.support.v4.app.FragmentPagerAdapter.instantiateItem(FragmentPagerAdapter.java:97)
at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:832)
at android.support.v4.view.ViewPager.populate(ViewPager.java:982)
at android.support.v4.view.ViewPager.populate(ViewPager.java:914)
at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1436)
at android.view.View.measure(View.java:15284)
at com.jeremyfeinstein.slidingmenu.lib.CustomViewAbove.onMeasure(CustomViewAbove.java:456)
at android.view.View.measure(View.java:15284)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:665)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:447)
at android.view.View.measure(View.java:15284)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.view.View.measure(View.java:15284)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:861)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:602)
at android.view.View.measure(View.java:15284)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2367)
at android.view.View.measure(View.java:15284)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1867)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1111)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1292)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1009)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4236)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
at android.view.Choreographer.doCallbacks(Choreographer.java:555)
at android.view.Choreographer.doFrame(Choreographer.java:525)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
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:4872)
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)

I think that the problem is the autocompletetextview i created. I mapped the array to get the position of array when i click in the dropdown during type what i want search.

At line 88 i have this:

ArrayMap<String, Integer>myArrayMap = new ArrayMap<String, Integer>();

The crash seems to be only with android 4.1 version. Is there any incompatibility?

like image 830
Atlas91 Avatar asked Jul 04 '14 12:07

Atlas91


1 Answers

ArrayMap was introduced in Api level 19, but it was also released in the compatibility library v4, so it would be enough to change the import to android.support.v4.util.ArrayMap instead of android.util.ArrayMap

like image 90
Blackbelt Avatar answered Sep 20 '22 19:09

Blackbelt