我每年只来一次,所以我不会每天使用Android。
我的目标是构建一个特定的项目,但由于我遇到了奇怪的错误,我最终决定:
但它并没有建造
由于这可能是最好的错误消息,控制台中的gradlew task说:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'HelloAndroid'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:2.2.3.
Required by:
:HelloAndroid:unspecified
> Could not resolve com.android.tools.build:gradle:2.2.3.
> org.apache.http.conn.ssl.SSLConnectionSocketFactory.<init>(Ljavax/net/ssl/SSLContext;Ljavax/net/ssl/HostnameVerifier;)V
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED您可以使用--调试--info --stacktrace 这里找到完整的日志。
我已经检查并重新安装了Java 8,试图在我的网络设置中发现任何阻塞的东西,当然,我重新安装了Android并重新启动了我的机器。
造成这些问题的原因是什么?或者我能找到原因吗?
编辑:我的构建文件是由Android生成的,我没有手动编辑它们。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:2.2.3'
// 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
}build.gradle (模块):
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.below.helloandroid"
minSdkVersion 25
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
testCompile 'junit:junit:4.12'
}发布于 2017-03-03 15:58:58
这似乎很奇怪,因为堆栈跟踪抱怨说,从4.4和Gradle版本2.14.1开始,就没有一个方法出现在httpclient中,您使用的是bundle 4.4.1。
我目前唯一能想象的是,您的Java ext dir中有一个较旧版本的httpclient,因此使用的是来自该旧版本的类,它没有此方法。
发布于 2017-03-03 19:40:18
在“吸血鬼”、“Michal”和“@dscheller”的帮助下,我删除了~/Library/Java/扩展名中的所有内容(包括http客户端),从而解决了这个问题。
https://stackoverflow.com/questions/42581341
复制相似问题