Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android project compiles, but maven dependencies not recognized in Android Studio

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.

like image 560
Blaz Avatar asked Dec 09 '22 10:12

Blaz


2 Answers

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.

like image 152
Michael Alan Huff Avatar answered Dec 11 '22 00:12

Michael Alan Huff


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.

like image 39
Patrick Kafka Avatar answered Dec 11 '22 00:12

Patrick Kafka