0

I'm working with Android Studio 1.2.2 and I don't know how to solve this problem:

error: package com.google.android.maps does not exist.

I added these lines to may build.gradle file under dependencies:

compile 'com.google.maps:google-maps-services:0.1.3'
compile 'com.google.android.gms:play-services:6.5.87'

But the same error is appearing when I try to build the project.

enter image description here

AymanKun
  • 241
  • 1
  • 4
  • 20

2 Answers2

1

You package name seems not correct, it should be:

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

You need to follow the link here, or video here to setup the map.

Make sure you compile latest play service:

compile 'com.google.android.gms:play-services:7.5.0'

and include permission, feature, mata-data(apikey and gems version) in you AndroidManifest :

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

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <!--
         The following two permissions are not required to use
         Google Maps Android API v2, but are recommended.
    -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

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


    <application
        android:allowBackup="true"
        android:icon="@mipmap/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>
        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="YOUR API KEY" />
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
    </application>

</manifest>

For demo project you can refer here.

bjiang
  • 6,068
  • 2
  • 22
  • 35
  • Please look at the screenshot above, I edited my question, as you can see I am trying to build an imported project that uses the com.google.android.maps package and I have no idea where can I find this package. – AymanKun Jun 25 '15 at 20:45
  • 1
    Oh, I see, I find that this package is very old or deprecated already, it maybe the google Map V1, right now we all use the Version2 and the package name is `com.google.android.gms.maps`, can you show me where you got the project? – bjiang Jun 25 '15 at 20:56
  • Yes I realized that the project I imported is using a deprecated version of google maps, it's the Mixare open source project, an AR project for tracking geographic points of interest using the phone camera live view, look here http://www.mixare.org/ – AymanKun Jun 25 '15 at 21:04
  • So maybe you can try to change the package from V1 to V2. You can refer [here](http://stackoverflow.com/questions/16079093/convert-android-app-that-uses-maps-api-v1-to-maps-android-api-v2/16079262#16079262) and [here](http://stackoverflow.com/questions/20258307/is-it-mandatory-to-change-the-google-map-api-v1-to-v2). – bjiang Jun 25 '15 at 21:10
0

Please ensure that you have downloaded and installed the Google Play services SDK in your Android SDK Manager

Also you can try declaring this in your Manifest.xml

<uses-library android:name="com.google.android.maps" />
Javed Ali
  • 1,510
  • 2
  • 12
  • 18
  • I have the google play services downloaded and added to the manifest but the error is still appearing. – AymanKun Jun 25 '15 at 20:23