J.Maduka
J.Maduka

Reputation: 93

Could not get unknown property 'VERSION_NAME' for project ':library' of type org.gradle.api.Project

When I import the RippleBackground library for my project as a module, following exception was thrown

Caused by: groovy.lang.MissingPropertyException: Could not get unknown property 'VERSION_NAME' for project ':library' of type org.gradle.api.Project.

But the versionName is already defined in the build.gradle file.

apply plugin: 'com.android.library'

android {
    compileSdkVersion 29
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.skyfishjy.library"
        minSdkVersion 11
        targetSdkVersion 29
        versionName "1.0.1"
        versionCode 2

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

dependencies {
}

apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'

Anyone can explain where the error is?

Upvotes: 1

Views: 3084

Answers (1)

Eugen Pechanec
Eugen Pechanec

Reputation: 38243

The publishing script imported on the last line requires some project properties, including VERSION_NAME, GROUP and others.

If you're not going to publish this library remove the line

apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'

Otherwise you'll need to put all the relevant properties in your gradle.properties file or provide them in the command line. You can open the URL in your browser and understand the properties from it.

Here, VERSION_NAME and versionName are not related.

Note: Android libraries don't have applicationId, versionCode or versionName. These properties are only used in Android apps. You can remove these lines.

Upvotes: 2

Related Questions