airbnb / airbnb/AirMapView

java.lang.Throwable: EventHub.removeMessages(int what = 107) is not supported before the WebViewCore is set up.

Open
#83 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.9k
Forks
212
PR merge metrics
No merged PRs in 30d

Description

Hi,
i have tried to create a sample with this code:

```
import com.airbnb.android.airmapview.AirMapMarker;
import com.airbnb.android.airmapview.AirMapPolyline;
import com.airbnb.android.airmapview.AirMapView;
import com.airbnb.android.airmapview.DefaultAirMapViewBuilder;
import com.airbnb.android.airmapview.listeners.OnMapInitializedListener;
import com.google.android.gms.maps.model.LatLng;

import java.util.Arrays;

public class SelectMapAreaGame extends AppCompatActivity implements OnMapInitializedListener {

private AirMapView map;
private DefaultAirMapViewBuilder mapViewBuilder;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select_map_area_game);

mapViewBuilder = new DefaultAirMapViewBuilder(this);
map = (AirMapView) findViewById(R.id.map_view);

map.setOnMapInitializedListener(this);
map.initialize(getSupportFragmentManager());

}

private void addMarker(String title, LatLng latLng, int id) {
map.addMarker(new AirMapMarker.Builder()
.id(id)
.position(latLng)
.title(title)
.iconId(R.drawable.ghost)
.build());
}

@Override public void onMapInitialized() {
System.out.println("Map onMapInitialized triggered");
final LatLng airbnbLatLng = new LatLng(37.771883, -122.405224);
addMarker("Airbnb HQ", airbnbLatLng, 1);
addMarker("Performance Bikes", new LatLng(37.773975, -122.40205), 2);
addMarker("REI", new LatLng(37.772127, -122.404411), 3);
addMarker("Mapbox", new LatLng(37.77572, -122.41354), 4);
map.animateCenterZoom(airbnbLatLng, 10);

// Add Polylines
LatLng[] latLngs = {
new LatLng(37.77977, -122.38937),
new LatLng(37.77811, -122.39160),
new LatLng(37.77787, -122.38864)};

map.addPolyline(new AirMapPolyline(Arrays.asList(latLngs), 5));

// Add Circle
map.drawCircle(new LatLng(37.78443, -122.40805), 1000);

// enable my location
map.setMyLocationEnabled(true);
}
}
```

and i have a blank view with this in the console:

```
W/webcore: java.lang.Throwable: EventHub.removeMessages(int what = 107) is not supported before the WebViewCore is set up.
at android.webkit.WebViewCore$EventHub.removeMessages(WebViewCore.java:1684)
at android.webkit.WebViewCore$EventHub.access$7900(WebViewCore.java:927)
at android.webkit.WebViewCore.removeMessages(WebViewCore.java:1796)
at android.webkit.WebView.sendOurVisibleRect(WebView.java:2953)
at android.webkit.ZoomManager.setZoomScale(ZoomManager.java:593)
at android.webkit.ZoomManager.access$1700(ZoomManager.java:49)
at android.webkit.ZoomManager$PostScale.run(ZoomManager.java:984)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
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:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
```

how i can fix?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the sample around AirMapView.initialize(), DefaultAirMapViewBuilder, and the OnMapInitializedListener callback, then compare the blank view with the Android WebView stack trace. Done means the sample displays the map and the reported initialization error no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.