Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Android place picker exception : bad array lengths #15780

Closed
manjunath-cy opened this issue Oct 4, 2019 · 3 comments · Fixed by #15788
Closed

Android place picker exception : bad array lengths #15780

manjunath-cy opened this issue Oct 4, 2019 · 3 comments · Fixed by #15788
Labels
Android Mapbox Maps SDK for Android

Comments

@manjunath-cy
Copy link

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.lge.myapplication/com.mapbox.mapboxsdk.plugins.places.picker.ui.PlacePickerActivity}: java.lang.RuntimeException: bad array lengths
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3021)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3156)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1864)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:205)
at android.app.ActivityThread.main(ActivityThread.java:6991)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:884)
Caused by: java.lang.RuntimeException: bad array lengths
at android.os.Parcel.readDoubleArray(Parcel.java:1259)
at com.mapbox.mapboxsdk.camera.CameraPosition$1.createFromParcel(CameraPosition.java:34)
at com.mapbox.mapboxsdk.camera.CameraPosition$1.createFromParcel(CameraPosition.java:27)
at android.os.Parcel.readParcelable(Parcel.java:2774)
at com.mapbox.mapboxsdk.plugins.places.picker.model.AutoValue_PlacePickerOptions$1.createFromParcel(AutoValue_PlacePickerOptions.java:21)
at com.mapbox.mapboxsdk.plugins.places.picker.model.AutoValue_PlacePickerOptions$1.createFromParcel(AutoValue_PlacePickerOptions.java:13)
at android.os.Parcel.readParcelable(Parcel.java:2774)
at android.os.Parcel.readValue(Parcel.java:2668)
at android.os.Parcel.readArrayMapInternal(Parcel.java:3037)
at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:288)
at android.os.BaseBundle.unparcel(BaseBundle.java:232)
at android.os.BaseBundle.getString(BaseBundle.java:1155)
at android.content.Intent.getStringExtra(Intent.java:7458)
at com.mapbox.mapboxsdk.plugins.places.picker.ui.PlacePickerActivity.onCreate(PlacePickerActivity.java:76)
at android.app.Activity.performCreate(Activity.java:7159)
at android.app.Activity.performCreate(Activity.java:7150)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)

@manjunath-cy
Copy link
Author

Even the plugin demo app also gives the same exception .

@manjunath-cy
Copy link
Author

I found out the reason for this issue.

It is because of padding[]=null in CameraPosition.java if we does not specify the padding while building CameraPosition objects using the new CameraPosition.Builder().

Please make the changes in the plugin to avoid this crash in CameraPosition.java -
public static final Parcelable.Creator CREATOR =
new Parcelable.Creator() {
public CameraPosition createFromParcel(Parcel in) {
double bearing = in.readDouble();
LatLng target = in.readParcelable(LatLng.class.getClassLoader());
double tilt = in.readDouble();
double zoom = in.readDouble();
double[] padding = new double[4];
in.readDoubleArray(padding);
return new CameraPosition(target, zoom, tilt, bearing, padding);
}

  public CameraPosition[] newArray(int size) {
    return new CameraPosition[size];
  }
};

@langsmith langsmith transferred this issue from mapbox/mapbox-plugins-android Oct 8, 2019
@langsmith langsmith added the Android Mapbox Maps SDK for Android label Oct 8, 2019
@langsmith
Copy link
Contributor

I transferred this from https://github.com/mapbox/mapbox-plugins-android because the topic of this ticket is the Maps SDK's CameraPosition class.

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

Successfully merging a pull request may close this issue.

2 participants