maplibre / maplibre/maplibre-plugins-android

Most demos crash due to not finding Streets layer

Open
#62 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
50
Forks
33
PR merge metrics
No merged PRs in 30d

Description

When I run the demo (after setting `maptilerApiKey` in `local.properties`), the vast majority of the samples in the sample app fail with this exception:

```
FATAL EXCEPTION: main
Process: org.maplibre.android.plugins.testapp, PID: 14496
java.lang.IllegalArgumentException: Could not find layer Streets
at org.maplibre.android.maps.Style.getPredefinedStyle(Style.java:1430)
at org.maplibre.android.plugins.testapp.activity.annotation.CircleActivity.lambda$onCreate$4$org-maplibre-android-plugins-testapp-activity-annotation-CircleActivity(CircleActivity.java:48)
at org.maplibre.android.plugins.testapp.activity.annotation.CircleActivity$$ExternalSyntheticLambda4.onMapReady(Unknown Source:4)
at org.maplibre.android.maps.MapView$MapCallback.onMapReady(MapView.java:1324)
```

if I instead edit `PluginApplication` and update:

```
MapLibre.getInstance(this)
```

to

```
MapLibre.getInstance(this, BuildConfig.MAPTILER_API_KEY, WellKnownTileServer.MapTiler)
```

many of the demos work, (though others crash still with the same exception with layer `Outdoors` instead of `Streets`). Is there any piece of setup I am missing here?

Also, is `mapbox_access_token` actually used? I set it, but I don't see anything in the code that reads it (neither in this repo nor in maplibre-native, minus some of their sample code).

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with PluginApplication and the failing demo entry point CircleActivity, then trace the MapLibre.getInstance configuration and the predefined Streets and Outdoors layer lookups shown in the stack trace. Check how maptilerApiKey and mapbox_access_token from local.properties are consumed. Done means the sample demos no longer fail because those layers cannot be found, and the token configuration behavior is understood.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.