Android Studio refuses to accept that Google Repository is installed
Asked Answered
S

2

7

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.

Streetcar answered 7/3, 2015 at 15:54 Comment(5)
Try opening & closing Studio. For some reason, that sometimes works for me.Durazzo
Thanks, but tried that already. Did not help.Streetcar
Getting exactly the same error, were you able to fix this?Telephony
A late answer: I gave up and just copied the contents of the old project into the new project.Streetcar
Same issue in IDEA 2016.1.3. (Not trying to use admob, but it refuses to accept that Google Repository is installed.)Jacksnipe
S
0

I was suffering with the same problem and finally found a simple solution (I'm using Android Studio 1.5.1 on MacOS):

  1. Go to File --> Project Structure

  2. On the left hand of the opened window, under Developer Services, select Ads

  3. Check the checkbox next to AdMod. Your window should look like this: enter image description here

  4. 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:

  1. Build --> Clean Project
  2. Build --> Rebuild Project

That's it! I hope this helps.

Scourge answered 28/12, 2015 at 21:22 Comment(0)
G
0

I have had that problem before. Here is the best solution that worked for me:

(in Android Studio Dolphin on Windows)

  1. Go to file --> Project Structure --> Dependencies
  2. Click "+" icon in All Dependencies Tab and click on Library Dependencies

Add library Dependencies

Now, you can search for Libraries and click on ok,and it will automatically add the required dependency to build.gradle.

Guttery answered 28/4, 2023 at 9:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.