我想我将地图Google API密钥添加到了错误的位置。请帮我:

相关的api密钥也更新了资源:

    <string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">AIzaSyAzSgqQEZ..........KMsLlN4</string>


 @Override
        protected String doInBackground(String... strings) {
            String response;
            try {
                String address = strings[0];
                HttpDataHandler http = new HttpDataHandler();

                String url = String.format("http://maps.googleapis.com/maps/api/geocode/json?address=%s&key=AIzaSyAzSgqQEZS1K1...........KMsLlN4", address);

            response = http.getHTTPData(url);
                return response;
            } catch (Exception ex) {

            }
            return null;
        }


我没有任何结果,我认为我的访问仍然被拒绝...
我应该放在哪里?

最佳答案

从官方文档->

got to the gradle.properties file and add a value with nameGOOGLE_MAPS_API_KEY="your api key"and rebuild project.After in your manifest file you will see api key.

PS不要忘记权限

10-08 02:24