小编Hah*_*ehe的帖子

无法在对象上找到参数 [directory 'libs'] 的方法compile()

我尝试获取 GetHttpResponse 这是下面的代码。我尝试过项目重新同步但无济于事。

完整错误:在 org.gradle.api.internal.artifacts.dsl.dependency.DefaultDependencyHandler 类型的对象上找不到参数 [directory 'libs'] 的compile()方法。

   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
        }
    }
Run Code Online (Sandbox Code Playgroud)

这是我的 gradle 文件

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'
    }
Run Code Online (Sandbox Code Playgroud)

这是我的 gradle 应用程序文件。我搜索了许多不同的问题并应用了它,但它仍然提示我错误。我还将可执行 jar …

android gradle android-gradle-plugin

3
推荐指数
1
解决办法
2万
查看次数

标签 统计

android ×1

android-gradle-plugin ×1

gradle ×1