当我尝试在android studio中运行我的第一个应用程序时出现以下错误
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:
Hellow_World: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 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.pom'.
> jcenter.bintray.com
以下是我的Gradle.script(模块)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.administrator.hellow_world"
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'
}
以下是我的Gradle.script(Hellow_World)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.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
}
有人可以帮我解决这个烂摊子吗?
答案 0 :(得分:9)
请按照下面提到的路径:
右键单击您的应用程序/项目 - >
打开模块设置 - >
转到“依赖关系”标签 - >
你会发现“junit:junit:4.12” - >选择它并右键单击并选择删除选项 - >确定
现在再次尝试构建您的应用程序。
答案 1 :(得分:0)
删除代码中的以下行
testCompile' junit:junit:4.12'
然后编译它。