【问题标题】:Error:(50, 28) No resource found that matches the given name (at 'value' with value '@string/google_maps_key')错误:(50, 28) 未找到与给定名称匹配的资源(在 'value' 处,值为 '@string/google_maps_key')
【发布时间】:2016-02-11 06:39:49
【问题描述】:

我正在使用 Android Studio 制作一个 Android 程序。打开Android Studio和Gradle过程完成后,我得到了

错误:(50, 28) 未找到与给定名称匹配的资源(在 'value' 处,值为 '@string/google_maps_key')"。

发生了什么?这是我第一次遇到这个错误。

【问题讨论】:

  • 缺少 google 地图键 检查值文件夹中的 google_maps_api.xml
  • 嗨 Maheshwar Ligade,这个程序是新的,当我在这个程序所在的文件夹中搜索时没有 google_maps_api.xml。请帮助解决这个问题的方法是什么。提前致谢。
  • 在清单中检查元
    嗨 Maheshwar Ligade,这是元代码:"”。它是否正确 ?提前致谢。
  • 在您的代码中,您从@string/google_maps_key 读取密钥,而不是直接放置密钥

标签: android google-play-services google-maps-android-api-2


【解决方案1】:

尽管这个问题是几年前的问题,但为了其他人的利益,我会添加一个答案。您应该看到一个名为 /src/debug/res/values/google_maps_api.xml 的文件(复制如下),在该文件中有生成和添加 maps 键的说明。替换字段 YOUR_KEY_HERE 与您的密钥。

To get one, follow this link, follow the directions and press "Create" at the end:

Once you have your key (it starts with "AIza"), replace the "google_maps_key"
string in this file.
-->
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">
    YOUR_KEY_HERE
</string>

【讨论】:

    【解决方案2】:

    使用 gradle 文件同步项目。

    【讨论】:

      猜你喜欢
      相关资源
      最近更新 更多
      热门标签