首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android : Gradle似乎与jcenter (?)

Android : Gradle似乎与jcenter (?)
EN

Stack Overflow用户
提问于 2017-03-03 14:23:36
回答 2查看 183关注 0票数 2

我每年只来一次,所以我不会每天使用Android。

我的目标是构建一个特定的项目,但由于我遇到了奇怪的错误,我最终决定:

  • 完全卸载Android
  • 重新安装Android ( 2.2.3和2.3,结果相同)
  • 使用IDE创建一个简单的项目
  • 试着建造它

但它并没有建造

由于这可能是最好的错误消息,控制台中的gradlew task说:

代码语言:javascript
复制
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(项目):

代码语言:javascript
复制
// 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 (模块):

代码语言:javascript
复制
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'
}
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-03-03 15:58:58

这似乎很奇怪,因为堆栈跟踪抱怨说,从4.4和Gradle版本2.14.1开始,就没有一个方法出现在httpclient中,您使用的是bundle 4.4.1。

我目前唯一能想象的是,您的Java ext dir中有一个较旧版本的httpclient,因此使用的是来自该旧版本的类,它没有此方法。

票数 2
EN

Stack Overflow用户

发布于 2017-03-03 19:40:18

在“吸血鬼”、“Michal”和“@dscheller”的帮助下,我删除了~/Library/Java/扩展名中的所有内容(包括http客户端),从而解决了这个问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42581341

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档