【问题标题】:Android gradle compile volley errorAndroid gradle 编译凌空错误
【发布时间】:2017-10-01 10:58:23
【问题描述】:

我刚刚添加了来自 Jcenter 的凌空抽射:

    compile 'com.android.volley:volley:1.0.0'

但同步 Gradle 时出现以下错误:

Error:Gradle DSL method not found: 'has()'

这是我的 gradle 项目文件:

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

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

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

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
        jcenter()
    }
}

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

这是我的模块 gradle 文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.2'
    defaultConfig {
        applicationId "com.dash.dashapp"
        minSdkVersion 21
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        debug {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

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.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.android.support:recyclerview-v7:25.3.1'
    compile 'com.android.support:cardview-v7:25.3.1'
    compile 'com.google.code.gson:gson:2.8.0'
    compile 'com.mindorks:placeholderview:0.2.7'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
    compile 'com.android.volley:volley:1.0.0'
    testCompile 'junit:junit:4.12'
}

【问题讨论】:

    标签: android android-studio android-gradle-plugin android-volley


    【解决方案1】:

    更改 Volley 的 bintray.gradle 文件中的行

    publish = project.has("release")
    

    publish = project.hasProperty("release")
    

    【讨论】:

    • 我之前看到过这个答案,很遗憾我决定用 Gradle 导入项目,因此我无权访问 bintray.gradle 文件
    猜你喜欢
    • 2013-05-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-08
    相关资源
    最近更新 更多