Search code examples
androidandroid-studioopenstreetmaposmdroid

osmdroid setUserAgentValue Cannot resolve Method


I have used this tutorial: https://github.com/osmdroid/osmdroid/wiki/How-to-use-the-osmdroid-library

But the Map doesn't show and I get an error: setUserAgentValue Cannot resolve Method

In this Line:

org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants.setUserAgentValue(BuildConfig.APPLICATION_ID);

I have imported this:

import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
import org.osmdroid.views.MapView;

And in my Gradle this:

compile 'com.google.android.gms:play-services-maps:9.6.1'
compile 'org.osmdroid:osmdroid-android:4.3'

Solution

  • osmdroid4.3 is out of date, and was not supporting setUserAgent.

    Upgrade to the latest version, replace with:

    compile 'org.osmdroid:osmdroid-android:5.4.1:release@aar'