【问题标题】:Android Studio refuses to accept that Google Repository is installedAndroid Studio 拒绝接受已安装 Google Repository
【发布时间】:2015-05-09 02:49:52
【问题描述】:

我正在尝试让 AdMob 运行。但由于某些奇怪的原因,我无法让 Android Studio 接受已安装 Google Repository。 问题是,它安装在 SDK 管理器中。现在重新安装了多次。项目结构 SDK 路径与 Android SDK Manager 中的相同。

当我将鼠标悬停在 build.gradle 中的 compile 'com.google.android.gms:play-services:6.+' 行上时,我会看到以下工具提示:

"Dependency on Play Services, but the SDK installation does not have the "Extras > Google Repository" installed. Open the SDK manager and install it"

当我尝试编译时,这个错误:

Error:Failed to resolve: com.google.android.gms:play-services:6.+

伴随该错误而来的是一个安装存储库的链接,我现在多次使用该链接。 Android Studio 不在乎。帮助。

edit:当我使用一个新的空项目时,它可以工作,并且 Android Studio 会找到存储库。不知道这里发生了什么。

【问题讨论】:

  • 尝试打开和关闭 Studio。出于某种原因,这有时对我有用。
  • 谢谢,但已经尝试过了。没有帮助。
  • 得到完全相同的错误,你能解决这个问题吗?
  • 一个迟到的答案:我放弃了,只是将旧项目的内容复制到新项目中。
  • IDEA 2016.1.3 中的相同问题。 (不尝试使用 admob,但它拒绝接受已安装 Google Repository。)

标签: android android-studio android-gradle-plugin android-sdk-manager


【解决方案1】:

我遇到了同样的问题,终于找到了一个简单的解决方案(我在 MacOS 上使用Android Studio 1.5.1):

  1. 转到文件 --> 项目结构

  2. 在打开的窗口左侧的开发者服务下,选择广告

  3. 选中 AdMod 旁边的复选框。您的窗口应如下所示:

  4. 点击确定

这会将所需的依赖项添加到 Android 的 build.gradle,并同步 Gradle。

同步完成后,确保清理并重建您的项目:

  1. 构建 --> 清理项目
  2. 构建 --> 重建项目

就是这样!我希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 2014-09-02
    • 2021-06-28
    • 1970-01-01
    • 2016-02-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-05
    相关资源
    最近更新 更多