我有一个用Android Studio编写的简单类:
package com.mysite.myapp;
import org.apache.http.client.HttpClient;
public class Whatever {
public void headBangingAgainstTheWallExample () {
HttpClient client = new DefaultHttpClient();
}
}
Run Code Online (Sandbox Code Playgroud)
从这里我得到以下编译时错误:
Cannot resolve symbol HttpClient
不HttpClient包含在Android Studio SDK中?即使不是,我也将它添加到我的Gradle构建中:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'org.apache.httpcomponents:httpclient:4.5'
}
Run Code Online (Sandbox Code Playgroud)
无论有没有最后一个编译行,错误都是一样的.我错过了什么?