无法在Android Studio中安装支持存储库并同步项目 [英] Cannot install Support repository and sync project in Android Studio

查看:145
本文介绍了无法在Android Studio中安装支持存储库并同步项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用版本25.2.0的支持库 因此我将能够使用 CameraKit 库.

I am trying to use the support libraries of version 25.2.0 so I will be able to use the CameraKit library.

我已经下载了最新的构建工具:

I have got the newest build tools downloaded:

和支持存储库:

我的gradle文件:

my gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.2'
    defaultConfig {
        applicationId "com.sample.myapp"
        minSdkVersion 21
        targetSdkVersion 25
        versionCode 1
        versionName "1.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
repositories {
    maven {
        url "https://jitpack.io"
    }
    mavenCentral()
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    testCompile 'junit:junit:4.12'

    // Google libraries
    compile 'com.android.support:appcompat-v7:25.2.0'
    compile 'com.android.support:design:25.2.0'
    compile 'com.android.support:support-v4:25.2.0'
    compile 'com.google.android.gms:play-services-vision:10.0.1'
    compile 'com.android.volley:volley:1.0.0'

    // Third party libraries
    compile 'com.flurgle:camerakit:0.9.17'

    compile 'com.android.support:recyclerview-v7:25.2.0'
    compile 'com.android.support:cardview-v7:25.2.0'
}

问题: 对于每个支持库,我都会遇到问题:

Problem: For each support-library I get the issue:

Failed to resolve com.android.support:cardview-v7:25.2.0

如果我尝试点击安装存储库并同步项目,则不会发生任何事情.

If I try to click on Install repository and sync project nothing happens.

我已将 gradle文件作为例子.可能是我的错吗?

I have followed that gradle file as an example. Were could be my mistake?

推荐答案

尝试使用最新的支持库版本:

Try using the latest support library versions:

compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.google.android.gms:play-services-vision:10.2.1'
compile 'com.android.volley:volley:1.0.0'
// Third party libraries
compile 'com.flurgle:camerakit:0.9.17'

compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'

这是详细信息依赖关系

编辑

使用 Google Maven存储库

要将它们添加到构建中,您需要首先在顶级build.gradle文件中包含Google的Maven存储库:

To add them to your build, you need to first include Google's Maven repository in your top-level build.gradle file:

项目-build.gradle (不是应用程序build.gradle)

 allprojects {
    repositories {
        // If you're using a version of Gradle lower than 4.1, you must instead use:
        maven {
            url 'https://maven.google.com'
        }
        // An alternative URL is 'https://dl.google.com/dl/android/maven2/'

       jcenter()
    }
}

这篇关于无法在Android Studio中安装支持存储库并同步项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆