Marievi Marievi - 3 months ago 11
Android Question

Cannot add Google Maps in Android app

I want to use various Google services in an Android app I am working on, such as Google Maps, Google Directions and Google Geolocation. I have followed the steps described in this link in order to get and Android API Key and I got one. I now try to add something very simple to my app, but it cannot even import package

com.google. ...
.

My
Android.Manifest
file is :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="di.uoa.gr.e_commerce" >

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name = "android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name = "android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".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>
<activity
android:name=".LoginActivity"
android:label="@string/title_activity_login" >
</activity>
<activity
android:name=".SignupActivity"
android:label="@string/title_activity_register" >
</activity>
<activity
android:name=".InitialActivity"
android:label="@string/title_activity_initial" >
</activity>
<activity
android:name=".AddActivity"
android:label="@string/title_activity_add" >
</activity>
<activity
android:name=".DeleteActivity"
android:label="@string/title_activity_delete" >
</activity>
<activity
android:name=".SeeCartActivity"
android:label="@string/title_activity_see_cart" >
</activity>
<activity
android:name=".ModifyActivity"
android:label="@string/title_activity_modify" >
</activity>
<activity
android:name=".SearchActivity"
android:label="@string/title_activity_search" >
</activity>

<meta-data
android:name="com.google.android.geo.AndroidKey"
android:value="xxx (my key)"/>

</application>




In the file
MainActivity.java
I try to import :

import com.google.android.gms.maps.GoogleMap;


but
google
is underlined with red saying :


Cannot resolve symbol Google.


I am sure I am missing something but can't figure out what.

Answer
add Library dependancy:
  com.google.android.gms:play-services-maps:9.4.0

permissions:
 <permission 
    android:name="com.example.androidmapsv2.permission.MAPS_RECEIVE" 
    android:protectionLevel="signature"></permission>
<uses-permission 
    android:name="com.example.androidmapsv2.permission.MAPS_RECEIVE"/>