Android的工作室不服,谷歌库安装工作室、Android、谷歌库

2023-09-08 09:48:42 作者:我逢场你便做戏

我想获得AdMob的运行。但是,对于一些奇怪的原因,我不能让Android的工作室接受了谷歌信息库已安装。事情是,它被安装在SDK管理器。现在重新安装多次。项目结构SDK路径是一样的Andr​​oid SDK管理器。

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.

当我将鼠标放在编译com.google.android.gms:播放服务:6 +'在我的build.gradle 行,我得到这个提示

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.+

使用该错误来一个链接到安装存储库,我现在多次使用。 Android的工作室并不关心。帮助。

With that error comes a link to install the Repository, which I used multiple times now. Android Studio does not care. Help.

编辑:当我使用一个新的空项目,它的工作原理,以及Android工作室找到库。不知道是怎么回事的。

edit: When I use a fresh empty project, it works, and Android Studio finds the Repository. No clue what is going on here.

推荐答案

我同样的问题苦难终于找到了一个简单的解决方案(我使用 Android的工作室 1.5.1在MacOS):

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

到文件的 - > 项目结构的在打开的窗口中的左侧,下的开发者服务的,选择的广告的

选中复选框的 AdMod 的旁边。您的窗口应该是这样的: 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:

点击的确定的

这将添加所需的依赖于Android的的build.gradle ,并同步摇篮。

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.