【问题标题】:Android 3.0 build gradle errors [duplicate]Android 3.0 构建 gradle 错误 [重复]
【发布时间】:2017-11-15 16:00:42
【问题描述】:

请在这张图片中看到这个错误

这是刚刚安装了 android studio 3.0 的 app.build 这是图片中的错误 不知道该怎么办了,请帮帮我

无法解析 ':app@debugUnitTest/compileClasspath' 的依赖关系:无法解析 junit:junit:4.12。

无法解析 junit:junit:4.12。 要求: 项目:应用程序

无法解析 junit:junit:4.12。 无法获取资源“https://dl.google.com/dl/android/maven2/junit/junit/4.12/junit-4.12.pom”。 无法获取“https://dl.google.com/dl/android/maven2/junit/junit/4.12/junit-4.12.pom”。 连接到 dl.google.com:443 [dl.google.com/172.217.24.14] 失败:连接超时:连接 连接超时:连接

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.mahilum.meebot"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

【问题讨论】:

  • 请添加错误信息
  • 嗨,如果答案对你有用,请接受它。
  • 没有需要更改的代码,请看图

标签: android android-studio


【解决方案1】:

请在应用构建 gradle 文件中添加以下行。

 android {
        compileSdkVersion 26
        flavorDimensions "default"
    }

【讨论】:

  • 为我工作。谢谢
  • 它对我不起作用
  • 请清理你的项目,按照我的建议添加flavorDimensions“默认”这一行。清理你的项目尝试一次。
  • 它并没有真正起作用,它只是又卡住了
猜你喜欢
  • 2018-06-03
  • 2018-04-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-08-12
  • 1970-01-01
相关资源
最近更新 更多