Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 使用额外属性时进行渐变依赖性检查_Android_Gradle - Fatal编程技术网

Android 使用额外属性时进行渐变依赖性检查

Android 使用额外属性时进行渐变依赖性检查,android,gradle,Android,Gradle,由于我的应用程序包含多个模块,我希望管理依赖项是一个中心位置,因此当我必须更新依赖项的版本时,我只需要在一个位置进行更新 因此,在我的根文件夹中的build.gradle中,我创建了依赖项作为额外属性: // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcente

由于我的应用程序包含多个模块,我希望管理依赖项是一个中心位置,因此当我必须更新依赖项的版本时,我只需要在一个位置进行更新

因此,在我的根文件夹中的
build.gradle
中,我创建了依赖项作为额外属性:

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

buildscript {
    repositories {
        jcenter()
        google()
        maven { url 'https://maven.fabric.io/public' }
        mavenLocal()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'

        classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'

        classpath 'com.google.gms:google-services:4.3.3'  // Google Services plugin

        classpath 'io.fabric.tools:gradle:1.31.1'
    }

    ext {
        androidBuildToolsVersion = '28.0.3'
        androidCompileSdkVersion = 28
        androidMinSdkVersion = 19
        androidTargetSdkVersion = 28

        def libsuVersion = '2.3.1'
        def daggerVersion = '2.26'
        def robolectricVersion = '4.2.1'

        libraries = [
                androidXLegacySupport: 'androidx.legacy:legacy-support-v4:1.0.0',
                androidXLifeCycleExtendions: 'androidx.lifecycle:lifecycle-extensions:2.1.0',
                androidXAppCompat: 'androidx.appcompat:appcompat:1.0.0',
                androidXMultidex: 'androidx.multidex:multidex:2.0.0',
                androidXRecyclerView: 'androidx.recyclerview:recyclerview:1.0.0',
                androidXConstraintLayout: 'androidx.constraintlayout:constraintlayout:1.1.3',
                guava: 'com.google.guava:guava:24.0-android',
                //...

                //testing dependencies
                jUnit: 'junit:junit:4.12',
                jUnitExt: 'androidx.test.ext:junit:1.1.1',
                mockito: 'org.mockito:mockito-core:3.2.0',
                mockitoAndroid: 'org.mockito:mockito-android:3.2.0',
                robolectric: "org.robolectric:robolectric:${robolectricVersion}",
                robolectricShadowMultidex: "org.robolectric:shadows-multidex:${robolectricVersion}",
                androidXTestCore: 'androidx.test:core:1.2.0',
                androidXTestRunner: 'androidx.test:runner:1.1.1',
                androidXTextEspressoCore: 'androidx.test.espresso:espresso-core:3.2.0'
        ]
    }
}

allprojects {
    repositories {
        jcenter()
        google()
        mavenCentral()
    }
}
在模块中,我声明了如下依赖项:

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

    implementation libraries.androidXAppCompat
    implementation libraries.guava
}
然而,我希望得到这样的警告:


我如何才能做到这一点?

请不要发布代码图像请不要发布代码图像