我正在与一个项目的朋友,因此需要将其导入到我的电脑。 但是这个项目包含一个Google Map Activity。因此,当我尝试在移动设备上运行它时,它完全打开(我可以使用登录活动),但地图保持空白(谷歌地图应用程序正常工作,因此它不是连接问题)。 当我们从朋友的电脑(它创建的地方)运行它时,我们的应用程序工作得很好。 我认为问题来自“Google地图API密钥”。导入android studio谷歌地图项目
<resources>
<!--
TODO: Before you run your application, you need a Google Maps API key.
To get one, follow this link, follow the directions and press "Create" at the end: https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=XXXX
You can also add your credentials to an existing key, using this line:
XXXXXXXX
Once you have your key (it starts with "AIza"), replace the "google_maps_key"
string in this file.
-->
<string name="google_maps_key" translatable="false" templateMergeStrategy="preserve">
Key
</string>
但是当我尝试创建一个新的,它不会改变任何东西。我认为它来自链接保持不变的事实。
我的问题是: 是否有可能在两台不同的计算机上拥有相同的“Google Maps API密钥”应用程序? 如果没有,是否可以更改Android Studio提供的链接,以便能够创建一个可以与该项目一起使用的新密钥? 或者我是否需要每次都重新创建项目?
你可能使用调试证书生成密钥检查环节。确保您使用发行证书(请参阅[文档](https://developers.google.com/maps/documentation/android/start#get_an_android_certificate_and_the_google_maps_api_key))。或者你正在使用调试密钥库文件,在这种情况下,你应该创建自己的。 – Andy