当我试图运行一个简单的程序时,我得到了一个与Gradle相关的错误:
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration':app:_debugUnitTestCompile'.
> Could not resolve junit:junit:4.12.
Required by:
MyApplication:app:unspecified
> Could not resolve junit:junit:4.12.
> Could not get resource 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.pom'.
> Could not GET 'htps://jcenter.bintray.com/junit/junit/4.12/junit-4.12.pom'.
> Connection to htps://jcenter.bintray.com refused . 我不知道如何修复它,请帮助。(我目前使用的是android studio 2.1.2版)我的模块build-gradle包含以下代码:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.n5110.myapplication"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
}发布于 2016-08-03 23:33:47
你的gralde.build有问题的部分是下面这一行:
testCompile 'junit:junit:4.12'这是一个单元测试库。如果你刚刚开始并且可能不会为你的项目编写测试用例,那么你可以通过简单地删除行来解决这个问题。但是,如果您确实需要该库,那么可以参考here。
https://stackoverflow.com/questions/38747105
复制相似问题