无法解决:ubuntu 上 android studio 1.4 中的 junit:junit:4.12 [英] Failed to resolve : junit:junit:4.12 in android studio 1.4 on ubuntu

查看:20
本文介绍了无法解决:ubuntu 上 android studio 1.4 中的 junit:junit:4.12的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 ubuntu 上的 android studio 1.4 中创建新项目时.

When i am creating new project in android studio 1.4 on ubuntu.

我在

testCompile 'junit:junit:4.12' 

在 app/build.gradle 上有消息

with message on app/build.gradle

Error:(23, 17) Failed to resolve: junit:junit:4.12
Show in File
Show in Project Structure dialog

//构建 gradle(应用模块)

// build gradle (app module)

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(项目)

// build gradle (project)

//顶级构建文件,您可以在其中添加所有子项目/模块通用的配置选项.

// 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.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
}

  • 我已经尝试过 错误:(23, 17) 无法解析:junit:junit:4.12
  • 推荐答案

    有些人通过添加下面的块来解决存储库缺少 URL 的问题.

    Some people have solved by adding below block for missing URL for repository.

    android {
        .....
        repositories {
            maven { url 'http://repo1.maven.org/maven2' }
        }
        .....
    }
    

    只是提一下:右键单击应用程序"文件夹并转到打开模块设置".然后移到最后一个选项卡依赖项"并通过搜索重新添加junit.我尝试添加早期版本,但未能使其正常工作.

    Just to mention : Right click on 'app' folder and goto 'Open Module Settings'. Then move to last tab 'Dependencies' and re-add junit by searching. I tried to add earlier versions but failed to get it working.

    这篇关于无法解决:ubuntu 上 android studio 1.4 中的 junit:junit:4.12的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆