找不到Gradle DSL方法:"classpath()" [英] Gradle DSL method not found: 'classpath()'

查看:216
本文介绍了找不到Gradle DSL方法:"classpath()"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  • 项目"FeedBack"可能正在使用不包含该方法的Android Gradle插件版本(例如,在1.1.0中添加了"testCompile"). 修复插件版本并同步项目
  • 项目"FeedBack"可能正在使用不包含该方法的Gradle版本. 打开Gradle包装器文件
  • 构建文件可能缺少Gradle插件. 应用Gradle插件
  • The project 'FeedBack' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0). Fix plugin version and sync project
  • The project 'FeedBack' may be using a version of Gradle that does not contain the method. Open Gradle wrapper file
  • The build file may be missing a Gradle plugin. Apply Gradle plugin
  • //顶层构建文件,您可以在其中添加所有子项目/模块共有的配置选项.

    // 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.1.0'
    
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    
        // The Fabric Gradle plugin uses an open ended version to react
        // quickly to Android tooling updates
        classpath 'io.fabric.tools:gradle:1.+'
    
    }
    
    allprojects {
        repositories {
            jcenter()
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    

    //模块:应用gradle文件

    //Module: app gradle file

    apply plugin: 'com.android.application'
    apply plugin: 'io.fabric'
    
    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.3"
    
        defaultConfig {
            applicationId "burpp.av.feedback"
            minSdkVersion 14
            targetSdkVersion 23
            versionCode 1
            versionName "1.0"
    
            multiDexEnabled true
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        testCompile 'junit:junit:4.12'
    
        compile('com.crashlytics.sdk.android:crashlytics:2.5.6@aar') {
            transitive = true;
        }
    
        compile('com.crashlytics.sdk.android:answers:1.3.7@aar') {
            transitive = true;
        }
    
        compile('com.appsee:appsee-android:2.2@aar') {
            transitive = true;
        }
        compile('io.fabric.sdk.android:fabric:1.3.10@aar') {
            transitive = true;
        }
        compile 'com.android.support:appcompat-v7:24.0.0-beta1'
        compile 'com.android.support:design:24.0.0-beta1'
        compile 'com.google.android.gms:play-services:9.0.2'
        compile 'org.apache.httpcomponents:httpclient:4.3.5'
        compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
        compile 'com.google.android.gms:play-services-ads:9.0.2'
        compile 'com.google.android.gms:play-services-auth:9.0.2'
        compile 'com.google.android.gms:play-services-gcm:9.0.2'
    }
    

    推荐答案

    您必须在buildscript块内插入classpath依赖项.

    You have to insert classpath dependencies inside buildscript block.

    buildscript {
        repositories {
            jcenter()
    
            maven { url 'https://maven.fabric.io/public' }
        }
    
        // move it here
        dependencies {
            classpath 'com.android.tools.build:gradle:2.1.0'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
    
            // The Fabric Gradle plugin uses an open ended version to react
            // quickly to Android tooling updates
            classpath 'io.fabric.tools:gradle:1.+'
        }
    }
    
    
    
    allprojects {
        repositories {
            jcenter()
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    

    这篇关于找不到Gradle DSL方法:"classpath()"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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