Maykon Michel
Maykon Michel

Reputation: 83

Set android app version from command line

I'm trying to set android app version code and name using project variables on running:

./gradlew bundleRelease -PversionName=1.0.0 -PversionCode=100

To use this on my app/build.gradle file:

defaultConfig {
    versionCode project.versionCode
    versionName project.versionName
    [...]
}

I remember to use this once, but this time I'm receiving the following weird error:

A problem occurred evaluating project ':app'.
> No signature of method: build_3d8oq36p9lc2a0ylsa4yduj2n.android() is applicable for argument types: (build_3d8oq36p9lc2a0ylsa4yduj2n$_run_closure1) values: [build_3d8oq36p9lc2a0ylsa4yduj2n$_run_closure1@6e40553b]

How can I set the app version code and name with gradle on the command line?

Upvotes: 3

Views: 1067

Answers (1)

Maykon Michel
Maykon Michel

Reputation: 83

Thanks, @akif for the help!

defaultConfig {
    versionCode project.versionCode.toInteger()
    versionName project.versionName
    [...]
}

Upvotes: 1

Related Questions