android - 我们如何找到 google_maps_api.xml 文件

标签 android google-maps api-key

Get a Google Maps API key

Your application needs an API key to access the Google Maps servers. The type of key you need is a Key for Android applications. The key is free. You can use it with any of your applications that call the Google Maps Android API, and it supports an unlimited number of users.

Choose one of the following ways to get your API key:

The fast, easy way: Use the link provided in the google_maps_api.xml file that Android Studio created for you:
    Copy the link provided in the google_maps_api.xml file and paste it into your browser. The link takes you to the Google

Developers Console and supplies information via URL parameters, thus reducing the manual input required from you. Follow the instructions to create a new project on the console or select an existing project. Create an Android API key for your console project. Copy the resulting API key, go back to Android Studio, and paste the API key into the element in the google_maps_api.xml file.

我想知道我们如何找到该文件。它位于何处?

最佳答案

在 Android Studio 3.0+ 中,当您签署 apk 时,release 和 debug 文件夹不包含任何 google_maps_api.xml。我不知道为什么?

但你只是简单地将元数据放在 AndroidManifest.xml 中

   <meta-data
                android:name="com.google.android.geo.API_KEY"
                android:value="@string/API_KEY"/>

并正确签署您的 apk, - 设置包名 - Google 开发者控制台的 SHA1 key (此处需要上传 key Google 的应用签名 key )

查看我的详细答案: https://stackoverflow.com/a/49692374/1978475

关于android - 我们如何找到 google_maps_api.xml 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34960315/

相关文章:

javascript - 什么时候需要 Google Maps API key ?

html - 如何安全地使用 Google API key

android - 当没有足够的空间时,有没有办法隐藏 View

java - 简单求和程序 Android java

android - 如何在 Android 中实现 Google Places API?

html - AGM map 填充容器

ios - 在 iOS 中使用 map 进行转弯导航

android - 不同计算机上的谷歌地图 v2 API key

android - 如何使用手机信号塔查找用户位置?

Android重复资源错误