Gradle 2.1版是必需的

时间:2018-01-18 17:21:23

标签: android gradle

我导入了一个Android项目,但Gradle引发了此错误:

错误:

Error:(1, 0) Gradle version 2.10 is required. Current version is 3.5.

Please fix the project's Gradle settings.
<a href="fixGradleVersionInWrapper">Fix Gradle wrapper and re-import project</a><br><a href="openGradleSettings">Gradle settings</a>

gradle-warpper.properties:

#Thu Jan 18 17:48:40 CET 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

的build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'androidsvgdrawable'

dependencies {
    compile(project(':integration-android')) {
        exclude(group: 'com.google.android', module: 'android')
    }
    compile 'com.android.support:support-annotations:26.0.2'
    compile 'com.android.support:support-compat:26.0.2'
    compile('com.android.support:support-v13:26.0.2') {
        exclude(group: 'com.android.support', module: 'support-fragment')
        exclude(group: 'com.android.support', module: 'support-media-compat')
    }
    compile 'com.android.support:support-core-utils:26.0.2'
    compile 'com.android.support:recyclerview-v7:26.0.2'
    compile 'com.android.support:cardview-v7:26.0.2'
    compile 'org.bitcoinj:bitcoinj-core:0.14.5'
    compile 'com.google.protobuf:protobuf-java:2.6.1'
    compile 'com.google.guava:guava:20.0'
    compile 'com.google.zxing:core:3.3.1'
    compile 'com.squareup.okhttp:okhttp:2.7.5'
    compile 'com.squareup.okhttp:logging-interceptor:2.7.5'
    compile 'com.squareup.moshi:moshi:1.5.0'
    compile 'org.slf4j:slf4j-api:1.7.25'
    compile('com.github.tony19:logback-android-classic:1.1.1-6') {
        exclude(group: 'com.google.android', module: 'android')
    }
    compile 'com.github.tony19:logback-android-core:1.1.1-6'
    compile 'com.google.code.findbugs:jsr305:2.0.3'
    testCompile 'junit:junit:4.12'
}

ext {
    archivesBaseName = 'bitcoin-wallet'
}

android {
    compileSdkVersion 'android-26'
    buildToolsVersion '26.0.3'

    lintOptions {
        abortOnError false
        disable 'MissingTranslation'
    }

    ....

我试图改变

  

“文件 - &gt;项目结构 - &gt;项目 - &gt;”Gradle版本“”。

我改变了

  

4.2至2.10。

永远不会在Android Studio(最近安装)上显示错误。

2 个答案:

答案 0 :(得分:0)

打开gradle文件并更改版本

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:x.x.x'
    }
}

答案 1 :(得分:0)

我解决了这个问题: 我的错误是在Android Studio中打开项目。我更喜欢使用“导入项目”(Android Studio启动)按钮。