supportLibraryVersion导致错误ERROR:无法解决:com.android受影响的模块:app

时间:2019-06-24 07:58:04

标签: android

我正在尝试在gradle项目级别添加项目级别扩展,并在应用级别gradle上使用它。

我正在使用Udemy的具有1.5年历史的指南,当然,他使用的某些库是旧的,因此我逐个手动对其进行了修复,所以现在我遇到了supportLibraryVersion的问题。在他的指导下为26.0.3,我按照Android Studio的建议将其手动更改为28.0.0。

这是我的项目级别gradle-


// 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.4.1'

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

allprojects {
    repositories {
        google()
        jcenter()

    }
}

ext {
    compileSdkVersion = 28
    buildToolsVersion = '28.0.3'
    minSdkVersion = 23
    targetSdkVersion = 28
    supportLibraryVersion = '28.0.0'
    daggerVersion = '2.15'
    retrofitVersion = '2.3.0'
    moshiVersion = '1.5.0'
    autoValueVersion = '1.5.1'
    autoValueMoshiVersion = '0.4.3'
    rxJavaVersion = '2.1.4'
    rxAndroidVersion = '2.0.1'
    rxRelayVersion = '2.0.0'
    conductorVersion = '2.1.4'
}

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

这是我的应用级别奖赏-


apply plugin: 'com.android.application'

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

dependencies {
//    implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
//    implementation "com.android.support:design'$supportLibraryVersion"

^
//this point is what breaks the code. when I uncomment it, it gives me the ERROR: Failed to resolve: com.android
Affected Modules: app


    implementation "com.google.dagger:dagger-android:$daggerVersion"
    implementation "com.google.dagger:dagger-android-support:$daggerVersion"
    annotationProcessor "com.google.dagger:dagger-android-processor:$daggerVersion"
    annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"

    implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
    implementation "com.squareup.retrofit2:converter-moshi:$retrofitVersion"
    implementation "com.squareup.moshi:moshi:$moshiVersion"
    annotationProcessor "com.ryanharter.auto.value:auto-value-moshi:$autoValueMoshiVersion"
    compileOnly "com.ryanharter.auto.value:auto-value-moshi-annotations:$autoValueMoshiVersion"

    compileOnly "com.google.auto.value:auto-value:$autoValueVersion"
    annotationProcessor "com.google.auto.value:auto-value:$autoValueVersion"

    implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
    implementation "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"
    implementation "com.jakewharton.rxrelay2:rxrelay:$rxRelayVersion"

    implementation "com.bluelinelabs:conductor:$conductorVersion"

    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'
}


如您所见,

supportLibraryVersion中的某些内容破坏了我的代码。希望有人能指出我想念的是什么

1 个答案:

答案 0 :(得分:1)

找到了答案

implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
implementation "com.android.support:design'<--mistyped that ' instead of : $supportLibraryVersion"