我是 android 应用程序开发的新手,这一个月我正在使用 android studio。之前,我创建了很多项目没有任何问题。这是我在创建新项目时收到这个奇怪错误的两天:
Error:Unable to find method 'org.apache.http.impl.client.DefaultHttpClient.setRedirectStrategy(Lorg/apache/http/client/RedirectStrategy;)V'.
Possible causes for this unexpected error include:<ul><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
<a href="syncProject">Re-download dependencies and sync project (requires network)</a></li><li>The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
<a href="stopGradleDaemons">Stop Gradle build processes (requires restart)</a></li><li>Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
</li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
我也卸载了 android studio 并再次安装,但仍然无法正常工作,而且我以前的项目也不适用于这个新的 android studio。
这就是我的 build.gradle 的样子:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
android {
compileSdkVersion 22
buildToolsVersion '19.1.0'
defaultConfig {
minSdkVersion 21
targetSdkVersion 21
}
productFlavors {
}
}
dependencies {
}