Abh*_*hek 9 ubuntu android android-studio
当我在ubuntu上的android studio 1.4中创建新项目时.
当gradle的同步完成时,我收到此错误
testCompile 'junit:junit:4.12'
Run Code Online (Sandbox Code Playgroud)
在app/build.gradle上显示消息
Error:(23, 17) Failed to resolve: junit:junit:4.12
Show in File
Show in Project Structure dialog
Run Code Online (Sandbox Code Playgroud)
// build gradle(app模块)
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'
}
Run Code Online (Sandbox Code Playgroud)
// build 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
}
Run Code Online (Sandbox Code Playgroud)
有些人通过添加下面的块来解决存储库中缺少的URL问题.
android {
.....
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
.....
}
Run Code Online (Sandbox Code Playgroud)
只需提及:右键单击"app"文件夹并转到"打开模块设置".然后移动到最后一个标签'Dependencies'并通过搜索重新添加junit.我试图添加早期版本,但未能使其正常工作.
小智 -2
//删除这一行- testCompile 'junit:junit:4.12'
并再次同步...对我有用-
dependencies
{
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12' //remove this line from here
compile 'com.android.support:appcompat-v7:23.0.1'
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
33519 次 |
最近记录: |