更新后的Gradle无法看到属性

时间:2019-06-25 05:42:36

标签: android gradle android-gradle

将gradle更新到最新版本后,我崩溃:

**ERROR: Cannot get property 'fileExtension' on extra properties extension as it does not exist**

Android库模块:

apply plugin: 'com.android.library'
apply from: "../artifactory/release.gradle"

android {
    compileSdkVersion project.compileSdkVersion

    defaultConfig {
        minSdkVersion project.minSdkVersion
        targetSdkVersion project.targetSdkVersion
        versionCode project.versionCode
        versionName project.versionName

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}


project.ext {
    name = "library-module"
    fileExtension = "aar" //file extension is defined in this module (not root project like other dependencies
}

release.gradle(看不到外部属性的文件):

apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
apply from: "../artifactory/config.gradle"




publishing {
    publications {
        aar(MavenPublication) {
            groupId project.groupId
            version project.versionName
            artifactId project.name
            artifact("$buildDir/outputs/aar/${project.getName()}-release.${project.ext.fileExtension}")
        }}}

奇怪的事实:项目名称是在库模块中定义的(但是在release.gradle文件中可以看到)

0 个答案:

没有答案