错误:(23,17)无法解析:JUnit的:JUnit的:4.12 [英] Error:(23, 17) Failed to resolve: junit:junit:4.12

查看:1140
本文介绍了错误:(23,17)无法解析:JUnit的:JUnit的:4.12的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即时通讯使用Android的工作室 为什么我创建一个新项目,每次总是出现错误:(23,17)无法解析:JUnit的:JUnit的:4.12

当我删除 testCompile'的JUnit:JUnit的:4.12 没问题了从属关系中的应用...

build.gradle

 应用插件:com.android.application

安卓{
    compileSdkVersion 23
    buildToolsVersion23.0.1

    defaultConfig {
        的applicationIDcom.okedroid.myapplication
        的minSdkVersion 17
        targetSdkVersion 23
        版本code 1
        VERSIONNAME1.0
    }
    buildTypes {
        推出 {
            minifyEnabled假
            proguardFiles getDefaultProguardFile('ProGuard的-android.txt'),'proguard-rules.pro
        }
    }
}

依赖{
    编译文件树(导演:库,包括:['的* .jar'])
    testCompile'的JUnit:JUnit的:4.12
    编译com.android.support:appcompat-v7:23.0.1
}
 

解决方案

我有同样的问题。通过添加URL缺少库解决:

 安卓{
    [...]
    库{
        行家{URLhttp://repo1.maven.org/maven2'}
    }
    [...]
}
 

就是这样。

im using Android Studio why every time I create a new project always comes up Error:(23, 17) Failed to resolve: junit:junit:4.12?

when I remove testCompile 'junit:junit:4.12' applications in dependencies no problem anymore...

build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.okedroid.myapplication"
        minSdkVersion 17
        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'
}

解决方案

I had the same problem. Solved by adding url for missing repository:

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

That's it.

这篇关于错误:(23,17)无法解析:JUnit的:JUnit的:4.12的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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