ApacheHTTP与Android 6.0(棉花糖)的连接
有没有办法将Apache库直接包含在Gradle中,以使其与Android 6.0一起工作 我试着将这些库包括在内:ApacheHTTP与Android 6.0(棉花糖)的连接,android,android-gradle-plugin,apache-httpclient-4.x,android-6.0-marshmallow,Android,Android Gradle Plugin,Apache Httpclient 4.x,Android 6.0 Marshmallow,有没有办法将Apache库直接包含在Gradle中,以使其与Android 6.0一起工作 我试着将这些库包括在内: compile 'org.apache.httpcomponents:httpcore:4.4.1' compile 'org.apache.httpcomponents:httpclient:4.5' Android Studio无法找到以下导入: import org.apache.http.auth.AuthenticationException; import org.
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
Android Studio无法找到以下导入:
import org.apache.http.auth.AuthenticationException;
import org.apache.http.auth.Credentials;
import org.apache.http.auth.MalformedChallengeException;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.impl.auth.DigestScheme;
根据API 22-23的差异更改,org.apache.http.*包在Android 6.0(棉花糖)API级别23时已被删除 via:讨论了Apache HTTP类的删除,并提出了一个解决方案: 要继续使用Apache HTTP API,必须首先在build.gradle文件中声明以下编译时依赖项:
android {
useLibrary 'org.apache.http.legacy'
}
在我的例子中,Android Studio仍然抱怨它找不到这些类,但应用程序确实构建并运行了
不过,该页面确实建议您移动到。尝试清洁和清洁rebuild@Hrk但最好将代码更新到最新的Androidstandards@Nepster尝试使用最新的android标准通过okhttp进行Http摘要,仍在等待良好的实现:(