Android Studio import Google Play Services project refresh failed - android

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

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.

Repo not found Unity Admob Plugin

I want to implements ads in my little android game that I am making in unity. I followed the steps here for the implementation of the admob unity plugin: https://firebase.google.com/docs/admob/unity/start
However, after I wrote my banner ad code, I cannot build the app anymore, because I am receiving the following errors:
Repo not found: C:\Android\extras\google\m2repository
Error: Unable to find dependency com.google.android.gms play-services-ads LATEST in ($SDK\extras\android\m2repository, $SDK\extras\android\m2repository)
I went and looked into the directory and I do not have the m2repository folder. So I am guessing I have to get it from somewhere, but I do not know where.
Install this packages in Android SDK Manager (GUI).
Android Support Repository.
Google Play Services
Google Repository (this have m2repository)

Add Firebase to Android app

I'm trying to install Firebase to my Android app, but it's seems like I'm doing something wrong. I have done exactly the same what I saw in this tutorial.
But when I put this compile 'com.google.firebase:firebase-core:9.6.1' into my project, I'm getting this error message:
Could not fint support-annotations.jar.....
The tutorial says something about this error:
Getting a "Could not find" error? Make sure you have the latest Google Repository in the Android SDK managerĖ›
The problem with this is that I have the latest version of Google Repository. And I cannot update it because there is no update available in SDK Manager.
Do you have you any idea what can I do to solve this?
In the Extras section of the Android SDK Manager, make sure the Android Support Library (v23.2.1) and Android Repository (v38) are installed and up to date.
The Support Annotation Library is described here.
The tutorial tip referring to the Google Repository applies when the "Could not find" error is for one of the Firebase libraries.
I had to update android studio and gradle plugins. After that everything works fine.

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

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.

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.

Categories

Resources