4

I added Google Play Services to my Android project in Gradle dependencies.

dependencies {
    compile 'com.google.android.gms:play-services:4.1.32'
}

The problem is that Android Studio does not recognize this dependency. I tried syncing project with gradle files, but classes are still not found.

I can manually import some classes from Google Play Services and use them in my code and it will compile with no problems.

If I import jar file from arr that is downloaded from maven everything works fine.

I tried this with couple of libraries and it is always the same. I am using Android Studio 0.4.2.

Blaz
  • 1,935
  • 15
  • 14
  • 2
    Try deleting all the Android Studio project files (*.iml, .idea folder, etc) and try reimporting the whole project. – rciovati Jan 22 '14 at 18:51

3 Answers3

8

I had the same problem but my solution didn't involve reimporting the project. I had downloaded some of the correct things in my SDK manager but not all the things that google play services needed.

enter image description here

I had downloaded the Google Play Services but not the Google Play Licensing Library and not the Google Repository. Turns out you need these guys as well. After downloading ALL the extras and restarting android studio, everything worked fine.

Michael Alan Huff
  • 3,462
  • 3
  • 28
  • 44
6

I ran into the other day and was going nuts until I found this

Android Studio suddenly cannot resolve symbols

It is solved by removing .idea folder and .iml files and reimporting.

Community
  • 1
  • 1
Patrick Kafka
  • 9,795
  • 3
  • 29
  • 44
0

this seems to be a bug in the current release of Android Studio. To make the editors recognize the classes you'll have to add the classes.jar file manually. It can be found in the build/exploded-bundles subdirectory of your project.