當我在ubuntu上的android studio 1.4中創建新項目時。未能解決:junit:junit:ubuntu上的android studio 1.4中的4.12
我收到此錯誤的gradle時的同步上
testCompile 'junit:junit:4.12'
完成對應用程序的消息/的build.gradle
Error:(23, 17) Failed to resolve: junit:junit:4.12
Show in File
Show in Project Structure dialog
//建立gradle這個(應用模塊)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.abhishek.vearch"
minSdkVersion 16
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.0.1'
compile 'com.android.support:design:23.0.1'
}
//構建gradle(項目)
//頂級構建文件,您可以在其中添加對所有子項目/模塊通用的配置選項。
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.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
}
亞我知道,但是我爲什麼要刪除這些添加上述兩行?那麼如果我想測試呢? – abhishek
我嚴重懷疑這是一個解決方案。 一個猜測是它使用的是Junit 3方法,它應該包含在android.jar中(例如在Api 19中),而不需要Junit 4.x. 或者更新的機器人愛普斯甚至有Junit 4. – cowst