简体   繁体   English

Android Studio不允许我“安装存储库并同步项目”

[英]Android Studio won't let me “Install repository and sync project”

I tried installing FirebaseUI and now I'm having this gradle errors. 我尝试安装FirebaseUI,现在遇到此gradle错误。 I tried installing the libraries that gradle is telling me in the build.gradle file but Android Studio is giving me this error and it doesn't let me press "Install repository and sync project". 我尝试安装gradle在build.gradle文件中告诉我的库,但是Android Studio给了我这个错误,并且不允许我按“安装存储库并同步项目”。

Error given by gradle Gradle给出的错误

Here's is my build.gradle file 这是我的build.gradle文件

    apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.avantefg.avante"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    signingConfigs {
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
        }
    }
    productFlavors {
    }
}

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'
    })
    compile('com.digits.sdk.android:digits:2.0.2@aar') {
        transitive = true;
    }
    compile('com.mikepenz:materialdrawer:5.8.0@aar') {
        transitive = true
    }
    dependencies {
        compile 'com.getbase:floatingactionbutton:1.10.1'
    }
    //Lollipin
    compile('com.github.orangegangsters:lollipin:2.0.0@aar') {
        transitive = true
    }
    compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
        transitive = true;
    }

    compile 'com.google.gms:google-services:3.1.0'
    compile 'com.wang.avi:library:2.1.3'
    compile 'jp.wasabeef:blurry:2.0.3'
    compile 'com.google.firebase:firebase-messaging:11.0.4'
    compile 'com.google.firebase:firebase-auth:11.0.4'
    compile 'com.firebaseui:firebase-ui-auth:2.2.0'
    compile 'io.github.yuweiguocn:SquareLoading:1.3.0'

    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.android.support.constraint:constraint-layout:1.0.0-beta4'
    compile 'com.android.support:customtabs:25.3.1'



    compile 'com.jakewharton:butterknife:8.4.0'
    compile 'com.cocosw:bottomsheet:1.+@aar'
    compile 'com.squareup.okhttp3:okhttp:3.4.2'
    compile 'com.github.barteksc:android-pdf-viewer:2.7.0-beta.1'
    compile 'com.android.volley:volley:1.0.0'
    testCompile 'junit:junit:4.12'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
}

apply plugin: 'com.google.gms.google-services'

Here's the project build.grade file 这是项目的build.grade文件

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'io.fabric.tools:gradle:1.+'
        classpath 'com.google.gms:google-services:3.1.0'



        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven{
            url "https://github.com/omadahealth/omada-nexus/raw/master/release"
        }
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Please someone help me! 请有人帮我!

Recently, Google start to distribute android support library by maven repo. 最近,谷歌开始通过maven repo分发android支持库。

You can try add 您可以尝试添加

maven { url 'https://maven.google.com' }

in your project level build.gradle 在您的项目级别build.gradle

example: 例:

buildscript {
    ext.kotlin_version = '1.1.3-2'
    repositories {
        maven { url 'https://maven.google.com' }
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-alpha9'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        maven { url 'https://maven.google.com' }
        jcenter()
        mavenCentral()
        maven { url 'http://devrepo.kakao.com:8088/nexus/content/groups/public/' 
}
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Friend the most solution for the "install repository and sync project" is Go to File>Invalidate Cache/Restart you will be shown a window asking to confirm restart.Be aware that local history will be cleared. 最好的“安装存储库和同步项目”解决方案是“转到文件”>“使缓存无效/重新启动”,您将看到一个窗口,要求确认重新启动。请注意,将清除本地历史记录。 if that does not check the library version that u installed and change it what u have. 如果那不检查您安装的库版本并更改您的库版本。

Here your dependency was not matching with your BuildTools so you need to give dependency as per your you build tool version for the resolution you need to remove all dependency or add from Project structure or else change version name as per build version like following, 在这里,您的依赖项与BuildTools不匹配,因此您需要根据构建工具版本提供依赖项,以达到需要从项目结构中删除所有依赖项或添加的分辨率,或者根据如下构建版本来更改版本名称,

Like I have already install build tool 25.0.1 and I give dependency like compile 'com.android.support:recyclerview-v7:25.0.2' So I need to change like compile 'com.android.support:recyclerview-v7:25.0.1' So It will work. 就像我已经安装了构建工具25.0.1一样,我给了像compile 'com.android.support:recyclerview-v7:25.0.2'这样的依赖关系,所以我需要像compile 'com.android.support:recyclerview-v7:25.0.1'一样进行更改compile 'com.android.support:recyclerview-v7:25.0.1'因此它将起作用。

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

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