我had a problem运行android-studios build gradle
,所以我测试了许多解决方案,但不幸的是我无法解决我的问题:
现在,我卸载旧的Android Studio和Android-sdk
,然后下载包含默认SDK的android studio 1.5.1。
我安装了它们并创建了一个空项目,但是构建项目需要30分钟,我将添加此时间段内显示的对话框窗口。
最终创建了此错误的项目:
Error:(23, 17) Failed to resolve: junit:junit:4.12
请问有人可以帮我吗?
build.gradle文件内容:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.armangar.app.fortest"
minSdkVersion 23
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
}
最重要的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
}
最佳答案
testCompile
是用于单元测试的配置(位于src / test中),而androidTestCompile
用于测试api(位于src / androidTest中)。
两者的主要区别是test
在常规Java JVM中运行,而androidTest
测试在Android设备(或仿真器)上运行。
因此,使用
testCompile 'junit:junit:4.12'
代替
androidTestCompile 'junit:junit:4.12'
来源:http://tools.android.com/tech-docs/unit-testing-support
关于android - Android Build Gradle尚未完成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35872739/