Add Google Maps to Android app -


i need adding google maps android app. have followed instructions on https://developers.google.com/maps/documentation/android/start, still error when running app.

this manifest:

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.image.app" android:versioncode="1" android:versionname="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name">     <activity android:name=".map" android:label="@string/app_name"         android:configchanges="keyboardhidden|orientation">         <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="aizasybhpmnlcvvmvscntwyvhmub65f1dwqsg5y" /> </application> <permission android:name="com.image.app.permission.maps_receive"     android:protectionlevel="signature" /> <uses-permission android:name="com.image.app.permission.maps_receive" /> <!-- access internet --> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission     android:name="com.google.android.providers.gsf.permission.read_gservices" /> <!-- take picture --> <uses-permission android:name="android.permission.camera" /> <uses-permission android:name="android.permission.write_external_storage" /> <!-- latitude longitude --> <uses-permission android:name="android.permission.access_fine_location" /> <uses-feature android:glesversion="0x00020000"     android:required="true" /> 

this main class:

import android.app.activity; import android.os.bundle;   public class map extends activity { @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.map); }  } 

this xml:

<?xml version="1.0" encoding="utf-8"?> <fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent"    android:name="com.google.android.gms.maps.mapfragment" /> 

go windows. android sdk manager. scroll down choose google play services under extras , install

enter image description here

copy google-play services_lib library project workspace. library project can found under following path.

     <android-sdk-folder>/extras/google/google_play_services/libproject/google-play-services_lib library project . 

click file > import, select android > existing android code workspace, , browse workspace import library project.

to check if library project. right click got properties choose android. see library checked below.

enter image description here

next refer library project in android map project.

right click on android map project goto properties. choose android. click add browse library project , click add , apply.

enter image description here

make sure api 12 , above. if not should use support fragment requires support library.


Comments