Could not find method compile() for arguments [directory 'libs'] on object

Viewed 16012

I tried getting GetHttpResponse which is the below code. I have tried to project resync to no avail.

Full error : Could not find method compile() for arguments [directory 'libs'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

   configure(':app') {
        dependencies {
            classpath 'com.android.tools.build:gradle:2.3.2'
            compile fileTree(dir: 'libs', include: ['*.jar'])
            testCompile 'junit:junit:4.12'
            compile 'com.android.support:appcompat-v7:23.0.1'
            compile 'com.android.support:design:23.0.1'
            compile 'org.apache.httpcomponents:httpcore:4.4.1'
            compile 'org.apache.httpcomponents:httpclient:4.5'
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }

This is my gradle file

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "itp361.nyp"
        minSdkVersion 23
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        useLibrary 'org.apache.http.legacy'
    }

This is my gradle app file . I have searched many different questions and applied it but it still prompts me the error. I have also added executable jar 'org.arpache.http.leagcy' to C:\Users\user\Downloads\NYP\NYP\app\libs

1 Answers
Related