2017-07-03 115 views
0

参数[目录“库”]方法编译()我试图获得GetHttpResponse其是下面的代码。我试图重新同步项目无济于事。未能找到关于对象

完整的错误:未能找到参数[目录 “库”]上 类型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 
     } 
    } 

这是我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' 
    } 

这是我gradle这个app文件。 找遍了许多不同的问题和应用,但它仍然会提示我的错误。我还添加了可执行的JAR 'org.arpache.http.leagcy' 到C:\用户\用户名\下载\ NYP \ NYP \程序\库

回答

1

阅读笔记。

// NOTE: Do not place your application dependencies here; they belong 
// in the individual module build.gradle files 

您在项目build.gradle。你必须把你的依赖放入模块build.gradle。这是你发布的第二个片段。

+0

更改后它适用于我,但我仍然无法“解析符号httpresponse”。什么是错误的? – HahaHehe

+0

@HahaHehe这是另一个问题,但您必须导入包在Android Studio中,您可以按ALT + ENTER以获得自动建议来解决这个问题。请不要问一个线程下一次在多个问题。 –

+0

我能问这个问题,您链接呢?很遗憾,并指出 – HahaHehe