将Android Studio更新到3.1.3后,依赖关系会出现一些错误

时间:2018-06-11 12:05:56

标签: android gradle build dependencies android-studio-3.1

嗨我在构建时遇到一些错误... 我是新的Android工作室 直到我将我的android工作室更新为3.1.3才有问题... 现在我在Gradle构建上播放了关于无法解决依赖关系的错误......

其My build.gradle(模块:app)

def kind
  puts "Type year and I'll tell you genre: "
  ask = gets.chomp

  kind = case ask
  when 1850..1889 then "Blues"
  when 1890..1909 then "Ragtime"
  when 1910..1929 then "New Orleans Jazz"
  when 1930..1939 then "Swing"
  when 1940..1950 then "Bebop"
  else "Jazz"
end


puts "You typed year #{ask}. Genre of music in that period is 
       #{kind}."
end

kind

和我的build.gradle(项目:)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.shoaib.newsletters"
        minSdkVersion 18
        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.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    compile 'com.tomerrosenfeld.customanalogclockview:custom-analog-clock-view:1.1'
    compile 'com.android.volley:volley:1.1.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
}

有错误

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

请告诉我如何解决这些问题...

1 个答案:

答案 0 :(得分:1)

当您使用appcompact-v7:26.1.0

您的约束布局版本必须

implementation 'com.android.support.constraint:constraint-layout:1.0.2'

并且测试应该是

androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

如果这有助于你,请更新