2015-09-25 83 views
5

HttpClient的是在目标23弃用,因此仍想使用的HttpClient在我的项目,因此我加入以下的gradle中的文件相关org.apache.http.legacy,重建项目后, ,我得到以下错误。gradle这个DSL方法没有找到“uselibrary()”

Error:(6, 0) Gradle DSL method not found: 'useLibrary()' Possible causes:

  • The project 'Development' may be using a version of Gradle that does not contain the method. Gradle settings
  • The build file may be missing a Gradle plugin. Apply Gradle plugin
  • 我gradle这个文件是

    apply plugin: 'com.android.application' 
    
    android { 
        compileSdkVersion 23 
        buildToolsVersion "22.0.1" 
        useLibrary 'org.apache.http.legacy' 
    
        defaultConfig { 
         applicationId "com.android.mobile.test" 
         minSdkVersion 15 
         targetSdkVersion 24 
        } 
    
        buildTypes { 
         release { 
          minifyEnabled false 
          proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
         } 
        } 
    
        lintOptions{ 
         abortOnError false 
        } 
    } 
    
    dependencies { 
        compile project(':library') 
        compile 'com.google.android.gms:play-services:+' 
        compile files('FlurryAnalytics-5.5.0.jar') 
        compile files('HockeySDK-3.5.0.jar') 
        compile 'com.android.support:appcompat-v7:23.0.1' 
        compile 'com.android.support:design:23.0.+' 
    } 
    

    根的build.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:1.0.0' 
        } 
    } 
    
    allprojects { 
        repositories { 
         jcenter() 
        } 
    } 
    
    +0

    请同时发布您的顶级'build.gradle'文件,您可以在您的项目根目录中找到该文件。 – CommonsWare

    +0

    添加请现在看看 –

    回答

    19

    变化:

    classpath 'com.android.tools.build:gradle:1.0.0' 
    

    到:

    classpath 'com.android.tools.build:gradle:1.3.0' 
    
    +5

    也是1.3.1,最后一个稳定版本。 –

    +0

    也是1.5.0,当前版本 – abriggs

    相关问题