java.lang.ArrayIndexOutOfBoundsException com.google.android.maps - android

I am getting this error in app that uses com.google.android.maps and the message is "Unfortunately the app has stopped."
E/AndroidRuntime( 3338): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
E/AndroidRuntime( 3338): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
E/AndroidRuntime( 3338): at
android.app.ActivityThread.access$600(ActivityThread.java:141)
E/AndroidRuntime( 3338): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
E/AndroidRuntime( 3338): at
android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(
3338): at android.os.Looper.loop(Looper.java:137) E/AndroidRuntime(
3338): at android.app.ActivityThread.main(ActivityThread.java:5039)
E/AndroidRuntime( 3338): at
java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(
3338): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 3338): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime( 3338): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime( 3338): at dalvik.system.NativeStart.main(Native
Method) E/AndroidRuntime( 3338): Caused by:
java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
E/AndroidRuntime( 3338): at
com.google.android.maps.MapActivity.createMap(MapActivity.java:575)
E/AndroidRuntime( 3338): at
com.google.android.maps.MapActivity.onCreate(MapActivity.java:423)
E/AndroidRuntime( 3338): at
com.ee.map.MainActivity.onCreate(MainActivity.java:170)
E/AndroidRuntime( 3338): at
android.app.Activity.performCreate(Activity.java:5104)
E/AndroidRuntime( 3338): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
E/AndroidRuntime( 3338): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
E/AndroidRuntime( 3338): ... 11 more
Has anybody seen such error and do you know what can causes this?
What is in com.google.android.maps.MapActivity.createMap(MapActivity.java:575)?

Related

Android build messed up

I'm developing a game for some time now under cocos2d-js. I was able to add plugin-x and facebook integration to android build. a few days ago I was trying to add admob as another plugin but i came across difficulties. I tried, for the first time ever to add the project to eclipse and try to deal with it there but I came up messing up the whole build. I tried to remove all the additions (admob, facebook, pluginx) and to start all over, but I keep getting this message after compilation & on-device-installation is done:
D/AndroidRuntime( 7513): Shutting down VM
W/dalvikvm( 7513): threadid=1: thread exiting with uncaught exception (group=0x41929ba8)
E/AndroidRuntime( 7513): FATAL EXCEPTION: main
E/AndroidRuntime( 7513): Process: com.shirkan.PiuPiu, PID: 7513
E/AndroidRuntime( 7513): java.lang.UnsatisfiedLinkError: Couldn't load cocos2djs from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.shirkan.PiuPiu-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.shirkan.PiuPiu-1, /vendor/lib, /system/lib]]]: findLibrary returned null
E/AndroidRuntime( 7513): at java.lang.Runtime.loadLibrary(Runtime.java:358)
E/AndroidRuntime( 7513): at java.lang.System.loadLibrary(System.java:526)
E/AndroidRuntime( 7513): at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:85)
E/AndroidRuntime( 7513): at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:99)
E/AndroidRuntime( 7513): at android.app.Activity.performCreate(Activity.java:5231)
E/AndroidRuntime( 7513): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
E/AndroidRuntime( 7513): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
E/AndroidRuntime( 7513): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
E/AndroidRuntime( 7513): at android.app.ActivityThread.access$800(ActivityThread.java:135)
E/AndroidRuntime( 7513): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
E/AndroidRuntime( 7513): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 7513): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 7513): at android.app.ActivityThread.main(ActivityThread.java:5001)
E/AndroidRuntime( 7513): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 7513): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 7513): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
E/AndroidRuntime( 7513): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
E/AndroidRuntime( 7513): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 490): Force finishing activity com.shirkan.PiuPiu/org.cocos2dx.javascript.AppActivity
Can anyone suggest what can cause such error?
Thanks.

java.lang.ClassNotFoundException when inflating a view from a jar

I want to replace the rotating icon in progress dialog with my custom icon. The custom icon is part of my own jar placed inside /device//package_name/Custom_View.java. When this class is referenced in my frameworks/base/core/res/res/layout/progress_dialog_holo.xml. I am having this crash
please help me resolve this issue.
E/AndroidRuntime( 699): *** FATAL EXCEPTION IN SYSTEM PROCESS: WindowManagerPolicy
E/AndroidRuntime( 699): android.view.InflateException: Binary XML file line #39: Error inflating class com.iamplus.aware.AwareProgressView
E/AndroidRuntime( 699): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
E/AndroidRuntime( 699): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
E/AndroidRuntime( 699): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
E/AndroidRuntime( 699): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
E/AndroidRuntime( 699): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
E/AndroidRuntime( 699): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
E/AndroidRuntime( 699): at android.app.ProgressDialog.onCreate(ProgressDialog.java:164)
E/AndroidRuntime( 699): at android.app.Dialog.dispatchOnCreate(Dialog.java:355)
E/AndroidRuntime( 699): at android.app.Dialog.show(Dialog.java:260)
E/AndroidRuntime( 699): at com.android.server.pm.ShutdownThread.beginShutdownSequence(ShutdownThread.java:223)
E/AndroidRuntime( 699): at com.android.server.pm.ShutdownThread.access$000(ShutdownThread.java:57)
E/AndroidRuntime( 699): at com.android.server.pm.ShutdownThread$1.onClick(ShutdownThread.java:140)
E/AndroidRuntime( 699): at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:190)
E/AndroidRuntime( 699): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 699): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 699): at com.android.server.wm.WindowManagerService$PolicyThread.run(WindowManagerService.java:882)
E/AndroidRuntime( 699): Caused by: java.lang.ClassNotFoundException: com.iamplus.aware.AwareProgressView
E/AndroidRuntime( 699): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
E/AndroidRuntime( 699): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
E/AndroidRuntime( 699): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
E/AndroidRuntime( 699): at android.view.LayoutInflater.createView(LayoutInflater.java:552)
E/AndroidRuntime( 699): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
E/AndroidRuntime( 699): ... 15 more
Make sure that you have added the external jar to your project build path.
After that, go to Project -> Properties -> Java Build Path -> Order and Export and mark the checkbox corresponding to your external jar.
Clean and build the project before you run.

How to override or.apache.http in Android platform

I have wrote an Android application that uses HttpComponents from Apache to make a connection to server.
The version I used is 4.3 (newest), everything is ok, except when running.
I got exception
E/AndroidRuntime( 1699): java.lang.ExceptionInInitializerError
E/AndroidRuntime( 1699): at org.apache.http.impl.conn.PoolingHttpClientConnectionManager$InternalConnectionFactory.<in
it>(PoolingHttpClientConnectionManager.java:487)
E/AndroidRuntime( 1699): at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConne
ctionManager.java:147)
E/AndroidRuntime( 1699): at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConne
ctionManager.java:136)
E/AndroidRuntime( 1699): at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConne
ctionManager.java:112)
E/AndroidRuntime( 1699): at net.xnano.weatherlife.util.ApacheHTTP.<init>(ApacheHTTP.java:97)
E/AndroidRuntime( 1699): at net.xnano.weatherlife.view.WeatherLifeActivity$3.<init>(WeatherLifeActivity.java:105)
E/AndroidRuntime( 1699): at net.xnano.weatherlife.view.WeatherLifeActivity.onOptionsItemSelected(WeatherLifeActivity.j
ava:105)
E/AndroidRuntime( 1699): at android.app.Activity.onMenuItemSelected(Activity.java:2548)
E/AndroidRuntime( 1699): at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:980)
E/AndroidRuntime( 1699): at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
E/AndroidRuntime( 1699): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:149)
E/AndroidRuntime( 1699): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
E/AndroidRuntime( 1699): at com.android.internal.view.menu.ActionMenuView.invokeItem(ActionMenuView.java:547)
E/AndroidRuntime( 1699): at com.android.internal.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:115)
E/AndroidRuntime( 1699): at android.view.View.performClick(View.java:4204)
E/AndroidRuntime( 1699): at android.view.View$PerformClick.run(View.java:17355)
E/AndroidRuntime( 1699): at android.os.Handler.handleCallback(Handler.java:725)
E/AndroidRuntime( 1699): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 1699): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 1699): at android.app.ActivityThread.main(ActivityThread.java:5041)
E/AndroidRuntime( 1699): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1699): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 1699): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime( 1699): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime( 1699): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1699): Caused by: java.lang.ExceptionInInitializerError
E/AndroidRuntime( 1699): at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.<init>(ManagedHttpClientConne
ctionFactory.java:72)
E/AndroidRuntime( 1699): at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.<init>(ManagedHttpClientConne
ctionFactory.java:84)
E/AndroidRuntime( 1699): at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.<clinit>(ManagedHttpClientCon
nectionFactory.java:59)
E/AndroidRuntime( 1699): ... 25 more
E/AndroidRuntime( 1699): Caused by: java.lang.NoSuchFieldError: org.apache.http.message.BasicLineFormatter.INSTANCE
E/AndroidRuntime( 1699): at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<init>(DefaultHttpRequestWriterFac
tory.java:52)
E/AndroidRuntime( 1699): at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<init>(DefaultHttpRequestWriterFac
tory.java:56)
E/AndroidRuntime( 1699): at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<clinit>(DefaultHttpRequestWriterF
actory.java:46)
E/AndroidRuntime( 1699): ... 28 more
The library (in jar archive) which I added to libs folder has been exported, it seems the application uses internal org.apache.http package instead of my own library.
The IDE is Intellij Idea.
Did anyone solve this issue before please help me?
This issue is presented a few times in SO. The solution I took was to use a repackaged version of the library called httpclientandroidlib. This was presented as a solution in a newer version of this question at How to Override Android Api Class with a class available in added jar?
You can use your own library in next way
com.yourlibrary.MyClass myClass= new com.yourlibrary.MyClass();

Exception when using custom attributes in layout

I have defined some custom attributes that I want to use throughout my app, which work fine when running through Eclipse, but throws an exception sometimes when the APK has been built and distributed. Below is the stack trace of the exception:
W/dalvikvm( 2521): threadid=1: thread exiting with uncaught exception (group=0x40f44300)
E/AndroidRuntime( 2521): FATAL EXCEPTION: main
E/AndroidRuntime( 2521): android.view.InflateException: Binary XML file line #13: Error inflating class <unknown>
E/AndroidRuntime( 2521): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
E/AndroidRuntime( 2521): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
E/AndroidRuntime( 2521): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
E/AndroidRuntime( 2521): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
E/AndroidRuntime( 2521): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
E/AndroidRuntime( 2521): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
E/AndroidRuntime( 2521): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
E/AndroidRuntime( 2521): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
E/AndroidRuntime( 2521): at com.myapp.android.ui.fragment.CustomDialogFragmentImpl.onCreateView(CustomDialogFragmentImpl.java:74)
E/AndroidRuntime( 2521): at com.myapp.android.ui.fragment.SupportCustomDialogFragment.onCreateView(SupportCustomDialogFragment.java:41)
E/AndroidRuntime( 2521): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:870)
E/AndroidRuntime( 2521): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1080)
E/AndroidRuntime( 2521): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:622)
E/AndroidRuntime( 2521): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1416)
E/AndroidRuntime( 2521): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:420)
E/AndroidRuntime( 2521): at android.os.Handler.handleCallback(Handler.java:615)
E/AndroidRuntime( 2521): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 2521): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 2521): at android.app.ActivityThread.main(ActivityThread.java:4745)
E/AndroidRuntime( 2521): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 2521): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 2521): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime( 2521): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime( 2521): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 2521): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime( 2521): at java.lang.reflect.Constructor.constructNative(Native Method)
E/AndroidRuntime( 2521): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
E/AndroidRuntime( 2521): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
E/AndroidRuntime( 2521): ... 23 more
E/AndroidRuntime( 2521): Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x2
E/AndroidRuntime( 2521): at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:463)
E/AndroidRuntime( 2521): at android.view.View.<init>(View.java:3342)
E/AndroidRuntime( 2521): at android.view.ViewGroup.<init>(ViewGroup.java:427)
E/AndroidRuntime( 2521): at android.widget.FrameLayout.<init>(FrameLayout.java:101)
E/AndroidRuntime( 2521): at android.widget.FrameLayout.<init>(FrameLayout.java:97)
E/AndroidRuntime( 2521): ... 26 more
Here is the view at line #13:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="12dp"
android:paddingLeft="?attr/listItemPaddingLeft"
android:paddingRight="?attr/listItemPaddingRight" >
Here is my defined attributes:
<declare-styleable name="MyAppTheme">
<attr name="listItemPaddingLeft" format="dimension" />
<attr name="listItemPaddingRight" format="dimension" />
<attr name="listItemHeight" format="dimension" />
<attr name="listHeaderHeight" format="dimension" />
</declare-styleable>
And lastly, here is my theme:
<style name="MyAppTheme" parent="#style/Theme.Sherlock.Light">
<item name="listItemPaddingLeft">22dp</item>
<item name="listItemPaddingRight">22dp</item>
<item name="listItemHeight">43dp</item>
<item name="listHeaderHeight">73dp</item>
</style>
Does anyone see any problems with the way I've defined things, or can offer an explanation as to why this would work when built locally, but not when the APK is signed? My device is the Galaxy Nexus, which worked fine locally and with the signed APK, but the Galaxy S3 does not work with the signed APK (wasn't able to test it locally).
You need to make sure that the currently (used)set theme is one which contains your custom attribute. You can set it in the manifest file or just set it explicitly before inflating the layout:
setTheme(R.style.MyAppTheme)
setContentView(R.layout.MyActivity);

GLSurfaceView.onDetachedFromWindow

I have a little issues with an GLSurfaceView, when I start my Activity I make the GLSurfaceView invisible with this line of code:
glSurface.setVisibility(View.INVISIBLE);
During this time I start an AsyncTask which downloads an Image from network, at this time, if I press the back button I meet this Exception:
java.lang.NullPointerException
E/AndroidRuntime( 1847): at android.opengl.GLSurfaceView.onDetachedFromWindow(GLSurfaceView.java:530)
E/AndroidRuntime( 1847): at android.view.View.dispatchDetachedFromWindow(View.java:6033)
E/AndroidRuntime( 1847): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1156)
E/AndroidRuntime( 1847): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1156)
E/AndroidRuntime( 1847): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1156)
E/AndroidRuntime( 1847): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1156)
E/AndroidRuntime( 1847): at android.view.ViewRoot.dispatchDetachedFromWindow(ViewRoot.java:1630)
E/AndroidRuntime( 1847): at android.view.ViewRoot.doDie(ViewRoot.java:2671)
E/AndroidRuntime( 1847): at android.view.ViewRoot.die(ViewRoot.java:2641)
E/AndroidRuntime( 1847): at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:218)
E/AndroidRuntime( 1847): at android.view.Window$LocalWindowManager.removeViewImmediate(Window.java:436)
E/AndroidRuntime( 1847): at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3684)
E/AndroidRuntime( 1847): at android.app.ActivityThread.access$2900(ActivityThread.java:125)
E/AndroidRuntime( 1847): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
E/AndroidRuntime( 1847): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1847): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 1847): at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime( 1847): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1847): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 1847): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime( 1847): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidR
What's wrong?
It could be that you haven't set the renderer.
From the android reference:
onDetachedFromWindow ()... Must not be called before a renderer has been set.
So, if you set the renderer (even if you aren't rendering anything yet), this might avoid the issue.

Categories

Resources