0

from showing every time I run my Test Application in my AVD. I'm trying to show a maps and Eclipse shows no mistakes. So how can I fix this and how can I find out what the problem is if Eclipse shows no problems?

(Here's a copy of my MainActivity)

    package com.example.test;

import android.app.Activity;  
import android.support.v4.app.FragmentActivity; 
import android.os.Bundle;


public class MainActivity extends FragmentActivity {

    @Override  
    protected void onCreate(Bundle arg0) {  
         // TODO Auto-generated method stub  
         super.onCreate(arg0);  
         setContentView(R.layout.activity_main);  
    }  
}  

(Here's a copy of my Activity_main.xml)

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:tools="http://schemas.android.com/tools"  
   android:layout_width="match_parent"  
   android:layout_height="match_parent"  
   tools:context=".MainActivity" >  
   <fragment  
     android:id="@+id/fragment1"  
     android:layout_width="match_parent"  
     android:layout_height="match_parent"  
     class="com.google.android.gms.maps.SupportMapFragment" />    

</RelativeLayout>

(Here's a copy of my TestManifest)

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.test"
     android:versionCode="1"  
   android:versionName="1.0" >  
   <uses-sdk  
     android:minSdkVersion="8"  
     android:targetSdkVersion="14" />  
   <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" />  
   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />  
   <uses-permission android:name="com.djandroid.mapsv2.permission.MAPS_RECEIVE" />  
   <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />  
   <uses-feature  
     android:glEsVersion="0x00020000"  
     android:required="true" />  
   <application  
     android:allowBackup="true"  
     android:icon="@drawable/ic_launcher"  
     android:label="@string/app_name"  
     android:theme="@style/AppTheme" >  
     <activity  
       android:name="com.example.test.MainActivity"  
       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.example.test..API_KEY"  
       android:value="AIzaSyBQ1sjxD09jxrSff68ZP77JpLQxm9LB8Hs" />  
     <uses-library  
       android:name="com.google.android.maps"  
       android:required="true" />  
   </application>  
</manifest>

please help me

djarod22
  • 39
  • 1
  • 5

4 Answers4

1

in manifest file

 <!-- Google API Key -->
<meta-data
    android:name="com.google.android.maps.v2.API_KEY"
    android:value="YOURAPIKEY" />
<meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />
Community
  • 1
  • 1
Pankaj Arora
  • 10,224
  • 2
  • 37
  • 59
0

You are missing <meta-data> tag in your Android_Manifest.xml

So please add this along with

<meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />

Also replace

<meta-data  
       android:name="com.example.test..API_KEY"  
       android:value="AIzaSyBQ1sjxD09jxrSff68ZP77JpLQxm9LB8Hs" />

as

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

You dont need

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

as you are using Google Maps v2

Lal
  • 14,726
  • 4
  • 45
  • 70
0

Looking at the code you are missing

...// rest of the code
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>  

You are missing

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

Also change this

<meta-data  
 android:name="com.example.test..API_KEY"  
 android:value="AIzaSyBQ1sjxD09jxrSff68ZP77JpLQxm9LB8Hs" /> 

to

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

You don't need

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

and

 <uses-permission android:name="com.djandroid.mapsv2.permission.MAPS_RECEIVE" /> 

Also

I run my Test Application in my AVD.

Note : Google maps require google play services installed. You need Google api platform 4.4.2 and above to test.

Its better to test it on a real device.

Raghunandan
  • 132,755
  • 26
  • 225
  • 256
  • Check my answer please...This is what i too has said... – Lal May 20 '14 at 15:54
  • @Lal so what? i din't copy it from you in fact i commented before i posted as anwer. And i also added a few more... – Raghunandan May 20 '14 at 15:55
  • Earlier you only said me not to post similar answers..i just pointed out...Sorry if u felt bad,,.. – Lal May 20 '14 at 15:57
  • @Lal I am not duplicating my answers. If i did don't hesitate to flag the answer. The moderators will deal with it appropriately. Nothing to feel bad. You can still flag my answer. I won't feel bad at all.. – Raghunandan May 20 '14 at 15:59
  • No i wont do that @Raghunandan..I respect you..I know you are a very good programmer in android(from your reps)..I am just a beginner in android and is trying to help others with my very little knowledge in android.. – Lal May 20 '14 at 16:02
  • @Lal what i said earlier relates to this http://meta.stackexchange.com/questions/104227/is-it-acceptable-to-add-a-duplicate-answer-to-several-questions. Pls read this. That is what i meant to say earlier – Raghunandan May 20 '14 at 16:04
  • I understand that Sir..That i didnt know...After that i havent done putting solutions for such questions..i just mark them as duplicates.. – Lal May 20 '14 at 16:07
0

PERMISSIONS

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


<permission android:name="com.example.test.permission.MAPS_RECEIVE"
    android:protectionLevel="signature" />
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<uses-permission android:name="com.example.test.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

Inside your Application tag, next to API KEY put

<meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />
Chefes
  • 1,892
  • 18
  • 17