Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gradle dsl method not found 'uselibrary()'

HttpClient is deprecated in target 23, So still I want use httpClient in my project therefore I have added following dependency org.apache.http.legacy in gradle file, after rebuild the project, I am getting following error.

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
  • My gradle file is

    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.+'
    }
    

    root 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()
        }
    }
    
    like image 252
    Lavekush Agrawal Avatar asked Sep 25 '15 10:09

    Lavekush Agrawal


    1 Answers

    Change:

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

    to:

    classpath 'com.android.tools.build:gradle:1.3.0'
    
    like image 82
    CommonsWare Avatar answered Nov 09 '22 02:11

    CommonsWare