2

I'm having some issues trying to import my project from Eclipse to Android studio. It is giving me errors such as error: package com.google.android.maps does not exist and error: cannot find symbol class MapActivity.

I've tried following the hundreds of posts about this problem and none seem to work. I tried putting this into my build.gradle: compile 'com.google.android.gms:play-services:3.1.36' and that doesn't work (I've also tried using the most current version as well). Is this a problem with deprecation, because it doesn't seem to be complaining about SitesOverlay?

I've tried changing my api key, which I don't think would give those errors. I've also seen posts about modules and such but then I read from a few posts that that is not necessary. I have also made sure that I downloaded all the correct sdk stuff including all the extras etc.

A few of the many sites I have referenced already:

Android Studio 0.2 App that use Google Maps - Gradle modify

com.google.android.maps does not exist strange error

Package com.google.android.maps does not exist (IntelliJ)

Community
  • 1
  • 1
Brandon Ling
  • 3,841
  • 6
  • 34
  • 49
  • If you're having problems with the IDE not being able to resolve symbols, have a look at http://stackoverflow.com/questions/21100688/android-studio-0-4-2-suddenly-cannot-resolve-symbols/21100896#21100896 and see how much it helps you – Scott Barta Jan 17 '14 at 21:23
  • I'll try that but I have never been able to resolve this even after re-importing multiple times. Thanks for the suggestion. – Brandon Ling Jan 17 '14 at 21:24
  • There's an issue in 0.4.2 where something bad is getting cached and re-import isn't helping. In my answer to that I have you blow away the .iml and .idea/ files and re-import. See if that helps, and if you're still stuck, revise your question with more details including your build.gradle files and more details on the exact errors you're seeing. – Scott Barta Jan 17 '14 at 21:28
  • Okay, thank you. To be honest, I don't understand why this isn't a simple import like it is in eclipse. – Brandon Ling Jan 17 '14 at 21:30
  • 1
    Not implemented yet. We've got a ways to go before we declare it 1.0. – Scott Barta Jan 17 '14 at 21:32
  • @BrandonLing check this out might be it can help you http://stackoverflow.com/questions/21081598/import-google-play-services-library-in-android-studio/21086904#21086904 – Piyush Agarwal Jan 18 '14 at 08:49

1 Answers1

1

My build.gradle file contains this:

dependencies {
compile 'com.android.support:appcompat-v7:+'
compile ('com.android.support:appcompat-v7:+')
compile ('com.google.android.gms:play-services:4.0.30')
}

Below, My map activity imports these :

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks;
import com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.location.LocationClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;

So I think it is just a cas of updating what you import to conform with the new map services.Specifically, you are using com.google.android.maps when you should be using com.google.android.gms.maps etc

Hope this helps.

Mohamed Taher Alrefaie
  • 15,698
  • 9
  • 48
  • 66
Carlos Taylor
  • 4,717
  • 3
  • 16
  • 16