Reputation: 39549
referencing the play-services via gradle stopped working for me - boiled it down - even the sample I used as a reference in the first place stopped working: https://plus.google.com/+AndroidDevelopers/posts/4Yhpn6p9icf
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':auth'.
> Failed to notify project evaluation listener.
> Could not resolve all dependencies for configuration ':auth:compile'.
> Could not find com.google.android.gms:play-services:3.1.36.
Required by:
gpsdemos:auth:unspecified
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 3.577 secs
I fear that just the version increased but that raises 2 questions: #1) what is the new one? #2) why is the old version gone?
Upvotes: 224
Views: 143464
Reputation: 73
I too had the same problem and resolved.
As per the above-mentioned solutions by others, I tried all the things and it does not solve my problem.
Even if you have two SDK locations, no need to worry about it and check whether your android home is set to Android studio SDK (If you have the Android repository and everything in that SDK location).
Solution:
I hope it will solve your problem.
Upvotes: 1
Reputation: 10364
Personally this post helped me to solve this issue by moving the google()
to the top of the repositories.
Upvotes: 0
Reputation: 21
I have the same question.
You should add some dependencies in build.gradle, just looks like this
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':libcocos2dx')
compile 'com.google.firebase:firebase-ads:11.6.0'
// the key point line
compile 'com.google.android.gms:play-services-auth:11.6.0'
}
Upvotes: 1
Reputation: 39549
Check if you also installed the "Google Repository". If not, you also have to install the "Google Repository" in your SDK Manager.
Also be aware that there might be 2 SDK installations - one coming from AndroidStudio and one you might have installed. Better consolidate this to one installation - this is a common pitfall - that you have it installed in one installation but it fails when you build with the other installation.
Upvotes: 465
Reputation: 23503
If you already have Google Repository installed, make sure it's updated. I had to update my Google Repository and services. This was after I updated Android Studio.
Upvotes: 3
Reputation: 1
By mistake I added the compile com.google.android.gms:play-services:5.+
in dependencies in build script block. You should add it in the second dependency block. make changes->synch project with gradle.
Upvotes: 0
Reputation: 7936
I had the same problem because I had:
compile 'com.google.android.gms:play-services:5.2.8'
and I solved changing the version numbers for a '+'. so the lines has to be:
compile 'com.google.android.gms:play-services:+'
Upvotes: 8
Reputation: 13181
In addition to installing the repository and the SDK packages one should be aware that the version number changes periodically. A simple solution at this point is to replace the specific version number with a plus (+) symbol.
compile 'com.google.android.gms:play-services:+'
Google instructions indicate that one should be sure to upgrade the version numbers, however adding the plus deals with the changes in versioning. Also note that when building in Android Studio a message will appear in the status line when a new version is available.
One can view the available versions of play services by drilling down on the correct repository path:
References
This site also has instructions for Eclipse, and other IDE's.
Upvotes: 37
Reputation: 2393
Just install Google Repository form your sdk manager and than restart Android Studio.
Upvotes: 60
Reputation: 41
I added a new environment variable ANDROID_HOME and pointed it to the SDK (C:\Program Files (x86)\Android\android-studio\sdk) that is inside the installation directory of Android Studio. (Environment variables are a part of windows; you access them through the advanced computer properties...google it for more info)
Upvotes: 2
Reputation: 499
I've been strugglin with this problem for hours till found this post. Just like @ligi said, some people have two SDK folders (Android Studio, which is bundled and Eclipse). The problem is that it doesn't matter if you downloaded the Google Play Services library on both SDK folders, your ANDROID_HOME enviroment variable must be pointing to the SDK folder used by the Android Studio.
SDK Folder A (Used on Eclipse)
SDK Folder B (Used on AS)
ANDROID_HOME=<path to SDK Folder B>
After change the path of this variable the error was gone.
Upvotes: 16
Reputation: 4078
Adding this as a second reference because I had a similar problem..
I had to explicitly add '.aar' as a registered file type under the 'Archives' category in AS settings.
Upvotes: 4