简体   繁体   English

Android Studio中缺少存储库

[英]Missing Repositories in Android Studio

I am working on a project in android studio that requires the use of google play services. 我正在android studio中一个需要使用Google Play服务的项目。 I understand that I need to install the SDK, but as seen in the photo, I am prompted with a link to download the repositories that I must use. 我知道我需要安装SDK,但是如图所示,系统会提示我一个链接,以下载必须使用的存储库。 Unfortunately, this link does not work and I cannot download the repositories, therefore my gradle will not sync. 不幸的是,此链接不起作用,我无法下载存储库,因此我的gradle无法同步。 What should I do? 我该怎么办?

我的密码

Two ways to solve this problem: 解决此问题的两种方法:

  1. Open SDK manager and install (from extras) play services. 打开SDK管理器并安装(从其他功能中)播放服务。 Install or update 安装或更新
  2. Press the "Install repository and sync project" in the Gradle build error 在Gradle构建错误中按“安装存储库并同步项目”

Both does the same thing: Install the repository required for app indexing. 两者具有相同的作用:安装应用程序索引所需的存储库。

Also see: 另请参阅:

this 这个

this 这个

and this 和这个

-- UPDATE -- -更新-

After searching a lot, I cannot find anything on app indexing with that package name on the internet or on android developers . 经过大量搜索之后,我在互联网或android开发人员上都找不到具有该包名称的应用索引。 I started expanding the search and I came over this . 我开始扩大搜索范围,并且遇到了这个问题 A lot of the google cloud services were moved to Firebase. 许多Google云服务已移至Firebase。 So, in theory, for it to work you have to use Firebase to access the dependency. 因此,从理论上讲,要使其正常工作,您必须使用Firebase来访问依赖项。 And the dependency is different from the one you are currently using(see the last link above) 而且依赖关系与您当前使用的依赖关系不同(请参阅上面的最后一个链接)

I have a feeling you are using the wrong API - for app indexing you should be using Firebase App indexing . 我感觉您使用的API错误-对于应用程序索引,您应该使用Firebase应用程序索引

Hence, according to the documentation your gradle file should look somewhat like this: 因此,根据文档,您的gradle文件应如下所示:

apply plugin: 'com.android.application'

android {
  // ...
}

dependencies {
  // ...
  compile 'com.google.firebase:firebase-core:10.2.0'

  // Getting a "Could not find" error? Make sure you have
  // the latest Google Repository in the Android SDK manager
}

// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM