Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Activity shows blank screen instead of map

I followed two tutorials to create an android app that displays a google map. The activity launches but there is no map visible. The zoom buttons on the side are seen though. What do I do to see the map ?

The Tutorial I used for the project structure

The Tutorial I used for the activity code

This is my manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.application.ridingo"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />
    <permission
            android:name="com.application.ridingo.permission.MAPS_RECEIVE"
            android:protectionLevel="signature" />

    <uses-feature
            android:glEsVersion="0x00020000"
            android:required="true" />

    <uses-permission android:name="com.application.ridingo.permission.MAPS_RECEIVE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />


    <application

        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.application.ridingo.Select_Route"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

        <meta-data
                android:name="com.google.android.maps.v2.API_KEY"
                android:value="ASDfrughiuniGDWUdhiWHdbi" />
    </application>

</manifest>
like image 317
Vipassana Vijayarangan Avatar asked Nov 12 '22 00:11

Vipassana Vijayarangan


1 Answers

The problem you describe usually happens when there is some problem with the way you defined Google Maps permissions (from a quick look at your manifest file the look OK) or from a bad configuration of the of the allowed API in the Google's API Console.

Take a look at this guide I wrote on how to configure Google Maps API V2 and make sure you do all the steps right:

Google Maps API V2

Make sure that you turn on the Google Maps V2 for Android in the console and not the one for web. another thing that looks strange in the manifest file you posted is your key (it looks too short - did you cut it in purpose) if you are not sure with the way you produced you key I would suggest you to go over this guide as well:

Google Maps API V2 key

like image 176
Emil Adz Avatar answered Nov 15 '22 11:11

Emil Adz