单个Android Studio项目的多个API密钥 [英] Multiple API keys for Single Android Studio Project
问题描述
我为Android和Google Places API使用Google Maps API v2,两者都有不同的api-keys被添加到清单中,但是当我添加这两个键时,我得到了多键错误。
I'm using Google Maps API v2 for android and Google Places API, both have different api-keys to be added to manifest, but when i add both the keys, i got multiple-key error.
是否可以为两个不同的API添加两个不同的键,如果不是,那么可能的解决方法是什么?
Is it possible to add two different keys for two different APIs, if not, then what is the possible work around?
<!-- Goolge Maps API Key -->
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyD****************U6QybngOI" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyA******************KDaKCEJU" />
推荐答案
我使用相同的GEO API密钥解决了问题对于Google Maps v2和Google Places API,即Geo api-key都可以用于api和maps api。
I solved the issue by using the same GEO API key for both Google Maps v2 and Google Places API, i-e the Geo api-key can be used for both places api and maps api as well.
<!-- Goolge Maps API Key -->
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyA******************KDaKCEJU" />
<!-- Google Places API Key -->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyA******************KDaKCEJU" />
这篇关于单个Android Studio项目的多个API密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!