osmdroid无法解析方法“ setUserAgentValue”

时间:2018-12-23 23:29:47

标签: android android-studio build.gradle openstreetmap osmdroid

我使用osmdroid构建地图应用程序。我在这一行有一个错误:

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

方法“ setUserAgentValue”为红色,无法解析。 这是我的摇篮:

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'

    implementation 'org.osmdroid:osmdroid-android:6.0.3'
    implementation 'com.squareup.retrofit2:retrofit:2.5.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

任何帮助将不胜感激,因为我迷失了方向! 非常感谢!!!

1 个答案:

答案 0 :(得分:2)

尝试替换为新版本

Configuration.getInstance().setUserAgentValue(BuildConfig.APPLICATION_ID)

来源:https://github.com/osmdroid/osmdroid/wiki/Important-notes-on-using-osmdroid-in-your-app#set-the-http-user-agent-variable