Lcom / google / android / libraries / maps / R $ string类中没有类型I的静态字段MAP_COPYRIGHTS_FULL;或其超类

时间:2019-06-20 17:08:20

标签: android google-maps

我在应用程序中使用了谷歌地图,并且在我的手机(Android 8)上运行正常,但是在我较旧的平板电脑(5.02)上却收到此错误消息。 我想这与依赖关系有关,但是我不能弄清楚是什么。这是我的礼物:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    //maps
    implementation name: 'maps-sdk-3.0.0-beta', ext: 'aar'

    //needed for maps
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.gms:play-services-basement:17.0.0'
    implementation 'com.google.android.gms:play-services-base:17.0.0'
    implementation 'com.google.android.gms:play-services-gcm:17.0.0'
    implementation 'com.google.android.gms:play-services-location:17.0.0'

    //tablayout
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.multidex:multidex:2.0.1'

    //retrofit
    implementation 'com.squareup.retrofit2:retrofit:2.5.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
}

有什么想法吗?

2 个答案:

答案 0 :(得分:0)

我不知道如何或为什么,但是maps-sdk-3.0.0-beta.aar中缺少strings.xml。 幸运的是,有人上传了翻译:https://github.com/greeshan/Android_4.2.x_multilang 我已经下载了另一种语言的strings.xml并将其复制到 \ AndroidStudioProjects \ MyAppWithMap \ app \ libs \ maps-sdk-3.0.0-beta.aar \ res \ values \ 文件夹,现在可以使用了。

答案 1 :(得分:0)

只需将这些添加到您的应用程序strings.xml

<string name="MAP_COPYRIGHTS_GOOGLE_ONLY">© %1$d Google</string>
<string name="MAP_COPYRIGHTS_FULL">© %1$d Google – Pictures © %2$d %3$s, Map Data © %4$d %5$s</string>
<string name="MAP_COPYRIGHTS_IMAGERY_ONLY">© %1$d Google – Pictures © %2$d %3$s</string>
<string name="MAP_COPYRIGHTS_MAP_DATA_ONLY">© %1$d Google – Map Data © %2$d %3$s</string>

在Google跟踪器上存在此问题: google issue tracker