Mariksel Azemaj
Mariksel Azemaj

Reputation: 592

Adding MapLibre to a new Android project is not working

I am following the documentation to add the MapLiber library to a new Android project https://maplibre.org/maplibre-native/docs/book/android/getting-started-guide.html

The Gradle sync seems to be working ok, but I get this error when trying to import the package

import org.maplibre.android.Maplibre

Unresolved reference: maplibre

this is how I added the dependency

implementation 'org.maplibre.gl:android-sdk:10.0.2'

What am i doing wrong?

Upvotes: 5

Views: 601

Answers (2)

SomeoneElse
SomeoneElse

Reputation: 479

As the other answer notes, there is an error in the documentation. Where it says

import org.maplibre.android.Maplibre

it should say

import org.maplibre.android.MapLibre

(note the capital "L")

The documentation also mentions

import org.maplibre.android.testapp.R

which you'll probably need to remove. Other parts of the documentation could benefit from a bit more detail, but this should get you going.

Upvotes: 0

EsatGozcu
EsatGozcu

Reputation: 422

There is a problem with the documentation. You can init like that:

import com.mapbox.mapboxsdk.Mapbox;

       Mapbox.getInstance(this);

enter image description here

Upvotes: 4

Related Questions