Google map displaying only blank tiles android

懵懂的女人 提交于 2019-12-17 16:14:07

问题


I have implemented google map in my app.But its display only blank grids.I have done changes in AndroidManifest.xml file and also included API key in layout file of map activity.


回答1:


This may sound silly, but I kept encountering this problem until I realized that the <uses-permission> tags need to be direct children to the <manifest> element, rather than the <application> element. I had erroneously been putting them right after the <uses-library> tag. So the final structure of your AndroidManifest.xml file should be something like this:

<?xml version="1.0" encoding="utf-8"?>
<manifest ... >
    <uses-sdk ... />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

    <application ... >
        <activity ... >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <uses-library android:name="com.google.android.maps" />

    </application>
</manifest>

Hope this helps anyone who was making the same mistake!




回答2:


I was having the same problems until I realised that in the API console I had enabled

Google Maps API v2

and not the

Google Maps Android API v2

Once I enabled it everything was fine.




回答3:


The problem is the code API. Use the following function to see if the Key Google Maps is correct:

private String getShaKey() {
        //fucnion para saber si esta bien registrado el codigo de googlemaps
        //ME SALE EXCEPTION DE NOMBRE NO ENCONTRADO?¿?¿
        String strRet="";
         try {
         PackageInfo info = getPackageManager().getPackageInfo("your.package.name",
         PackageManager.GET_SIGNATURES);
         for (Signature signature : info.signatures) {
         MessageDigest md = MessageDigest.getInstance("SHA");
         md.update(signature.toByteArray());
         //Log.v(TAG, "KeyHash:" + Base64.encodeToString(md.digest(),
         strRet="KeyHash:" + Base64.encodeToString(md.digest(),Base64.DEFAULT);

         }

         } catch (NameNotFoundException e) {
            //e.printStackTrace();
         strRet="EXCEPTION NOMBRE NO ENCONTRADO";
             } catch (NoSuchAlgorithmException  e) {
         //e.printStackTrace();
         strRet="EXCEPTION ALGORITMO NO";
         }
        return strRet;

         }



回答4:


This happens to me also. On the first time I successfully launched the Google maps, in works fine, on the second day, the entire map(default view) is rendered only in half while the other half are filled with tiles only, after changing some properties in the map, it all went to tiles only.

Now, what I did is I renew my API key and everything went fine.




回答5:


I had the same problem. I added this line on the Manifest.xml and everything is working fine now :

<uses-library android:name="com.google.android.maps" />


来源:https://stackoverflow.com/questions/5763789/google-map-displaying-only-blank-tiles-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!