osmdroid 无法解析方法 "setUserAgentValue"

osmdroid Cannot resolve method "setUserAgentValue"

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

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

方法"setUserAgentValue"为红色,无法解析。 这是我的 Gradle:

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'
}

任何帮助将不胜感激,因为我正在失去理智! 非常感谢!!!

尝试更换为较新的

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