Cannot resolve com.google.android.gms:play-services-base:6.5.+ - android

I launched my android studio and found that the following lines in the dependencies section of build.gradle are not compiling:
compile 'com.google.android.gms:play-services-base:6.5.+'
compile 'com.google.android.gms:play-services-identity:6.5.+'
Gradle Sync tells me that it cannot resolve the packages. I know the newest version of play-services is 7.8.0 but I'm not sure if this is related to that in any way. Any advice?
EDIT: I should mention that if I use 7.8.0, gradle does not complain, as it can find the package. However the methods I am using in my app that pertain to play services become invalid, as Google has updated how their Cloud Messaging works.

In the folder
Android/Sdk/extras/google/m2repository/com/google/android/gms/play-services-base open the maven-metadata.xml file
and add the <version>6.5.87</version> under section <versions>. It may look like below
<versions>
<version>6.5.87</version>
<version>7.0.0</version>
<version>7.3.0</version>
<version>7.5.0</version>
</versions>
Do the same for Android/Sdk/extras/google/m2repository/com/google/android/gms/play-services-identity
Note: Usually Android SDK in your HOME folder.

You probably need to download the play services package.
Go to Tools -> Android -> SDKManager
In the Extra section at the bottom of the list, make sure you have Google Play Services marked as installed.
If you use the latest android studio, once you open the SDKManager, go to the SDK Tools and make sure Google Play Services is checked.

Related

Error failed to resolve: compile 'com.google.android.gms:play-services-cast-framework:9.4.0'

tried to build a sample project after downloading from github.
But some errors showed up. Others solved but Couldn't resolve above issue mentioned in title.
Cast framework is required for this project but can't find it even after searching in project structure, shows nothing.
What can I do to resolve this issue?
Thanks.
Make sure you have set up Google Play Services SDK.
Start Android Studio
On the Tools menu, click Android > SDK Manager.
Update the Android Studio SDK Manager: click SDK Tools, expand Support Repository, select Google Repository, and then click OK.
The latest version of play services is 10.0.1. Under the buid.gradle of your application module, write:
dependencies {
compile 'com.google.android.gms:play-services-cast:10.0.1'
}
and click on Sync.

How to enable automatic download of missing Android SDK packages in Gradle

During Google I/O 2016's What's new in Android development tools a great new feature was quickly mentioned: Android Gradle plugin can now automatically download missing dependencies from Android SDK.
It's also mentioned in Android Gradle plugin 2.2.0-alpha4 release notes.
How do I enable it?
In gradle.properties file in your project's root folder add the following line:
android.builder.sdkDownload=true
Note: at the time of writing this option is experimental. It looks like so far it downloads missing build tools and platforms, but doesn't attempt to update repositories where the support libraries or Google Play Services libraries live according to a bug report/feature request.
Edit: since now support libraries and other libraries from Google live on maven.google.com and not in local repositories, the note above isn't as important.
I did:
gradle --refresh-dependencies
on the terminal, and it solved the problem.

Android Studio refuses to accept that Google Repository is installed

I am trying to get AdMob running. But for some strange reason, I can not get Android Studio to accept that the Google Repository is installed.
Thing is, it is installed in the SDK manager. And reinstalled multiple times now. Project Structure SDK path is the same as in Android SDK Manager.
When I mouse over the compile 'com.google.android.gms:play-services:6.+' line in my build.gradle, I get this tooltip:
"Dependency on Play Services, but the SDK installation does not have the "Extras > Google Repository" installed. Open the SDK manager and install it"
When I try to compile, this error:
Error:Failed to resolve: com.google.android.gms:play-services:6.+
With that error comes a link to install the Repository, which I used multiple times now. Android Studio does not care. Help.
edit: When I use a fresh empty project, it works, and Android Studio finds the Repository. No clue what is going on here.
I was suffering with the same problem and finally found a simple solution (I'm using Android Studio 1.5.1 on MacOS):
Go to File --> Project Structure
On the left hand of the opened window, under Developer Services, select Ads
Check the checkbox next to AdMod. Your window should look like this:
Click OK
This will add the required dependency to the Android's build.gradle, and sync Gradle.
When the sync is done, and just to make sure, clean and rebuild your project:
Build --> Clean Project
Build --> Rebuild Project
That's it! I hope this helps.

Android Studio import Google Play Services project refresh failed

currently I'm trying to import the Google Play Services for my Android project which is created using Android Studio. Now, I read the part where I should start from here and since this one is still using Eclipse I ended up in these steps. Now upon adding the Google Play Services on my app I receive an error saying:
Gradle 'MyApp' project refresh failed:
Could not find com.google.android.gms:play-services:5.0.77.
Required by:
MyApp:myapp:unspecified
So I tried changing the versions on this line:
compile 'com.google.android.gms:play-services:5.0.77'
into:
compile 'com.google.android.gms:play-services:5.0.+',
compile 'com.google.android.gms:play-services:4+',
compile 'com.google.android.gms:play-services:4.0.+',
so on but still getting the same error (only the version changes).
As for reference my Android Studio Version is currently # 0.5.2 (I cant update yet)
Grade ver 0.9.+.
And the screenshot of my installed packages in Android SDK Manager:
Now I'm wondering where exactly my problem is. And additionally I don't want to download a JAR file of the Google Play Services to solve this. I want to stick on the official way for implementing this in Android Studio. :D
Install Google Repository from the SDKManager.If you can't find Google Repository then update your SDK Tools,SDK Platform Tools,SDK Build Tools from the Tools section

Where is com.google.android.gms?

Today I updated Android SDK components to the newest version and somehow the whole com.google.android.gms package is gone. Instead, there is only com.google.android.maps with different classes than those in gms package. Is it a big change form Google or have I done something wrong? I have been using GoogleMap and LatLng classes to work with google maps and now I have just errors in my project.
Is it a big change form Google or have I done something wrong?
com.google.android.gms comes from the Play Services SDK, which you attach to your application project as an Android library project. Please check your environment to ensure that you have a valid copy of the Play Services library project and that your application project still points to it.
First off, if you did not run any updates with Android SDK Manager make sure the google-play-services-lib' project is open in eclipse. If this doesn't fix your problem then proceed. Note: eclipse(v22.0.1-685705) will close google-play-services-lib project with a 'close unrelated projects' command. The google-play-services-lib project must be open.
I figured this problem out. Initially, you/I installed Google Play services in eclipse directly from the SDK Path, (SDK Path is displayed on the top left of Android SDK Manager). When you updated Google Play services with the Android SDK Manager it deleted the .project file and now eclipse can't find the 'google-play-services-lib' project and your development project fails to compile. :-(
Solution:
The basic ideal of this solution is to clean out the old 'google-play-services-lib' project in eclipse, which is now defunct and install a new one with the project copied from the SDK path.
Delete the old project:
In eclipse delete any 'google-play-services-lib' project. (In Eclipse see: Project properties-> Android -> Library.)
In In Eclipse see: Project properties-> Android -> Library delete the old entry for 'google-play-services-lib' project. This will most likely have an red 'X' on it.
Install a new one:
Follow the instruction from Google to install 'google-play-services-lib' project. These instruction specify to copy the project out of the SDK install folder; and then how to set up the projects.
http://developer.android.com/google/play-services/setup.html
Notes:
Your name for 'google-play-services-lib' may be different.
The key to remember is that Google play services is not a jar file. It is a project in eclipse. Your, development project references the google-play-services-lib project.
By copying the project folder from the SDK path to another location, this will keep the Android SDK Manager from deleting your eclipse .project file, and causing this problem. The draw back is if you would like to update google play services, you have to remember to do all the steps again.
You will need Google Play Services sdk. You can install it from Android SDK Manager, if you are using sdk for eclipse.
After installing Google Play services, you can import the library project in your Workspace from ..\sdk\extras\google\google_play_services folder. Clean and build it.
Now you can go to the properties of project having problem and select the library project in Android section.
This should work!
Currently library is in Google Repository. To enable it make sure you have downloaded it using Android SDK Manager (down to the very bottom of the list).
For android create project [...] ant CLI-based project
Similar to: How to correctly include the support library in non-Eclipse Android application
The best I could find was https://stackoverflow.com/a/30689979/895245:
copy paste android-sdk/extras/google/google_play_services/libproject/google-play-services_lib directory in the project directory
cd into it and run android update project -p . -t android-22
add <property name="android.library.reference.1" value="./google-play-services_lib"/> to your build.xml.
You can install extras with the android GUI tool, or with this CLI method: Downloading the Android support library from command line
If you just copy paste the .jar in <sdk>/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar under the libs/ directory of the project, it compiles but breaks at runtime because of the required res/values/version.xml which is not included in the .jar.
If using Android Studio you can add the Google Play Services to use the Google Android Maps v2 by adding a dependency to the build.gradle file.
dependencies {
compile 'com.google.android.gms:play-services:3.1.36'
}

Categories

Resources