Could not set unknown property ‘archivesBaseName’

So, I migrated one of my Android/Kotlin project to Gradle 9, and whoopsy, an error message said I cannot write the archivesBaseName property anymore:

defaultConfig {
   [...]
   applicationName "toolsboox"
   versionCode 1070200
   versionName 1.7.2
   setProperty("archivesBaseName", "$applicationName-$versionName")
   [...]
}

It helped a lot to include the version in the apk/aab file name, and I realized the archivesBaseName property has been deprecated since years, and was removed in the Gradle 9, the upgrade notes wasn’t very helpful, but I found a encouraging thread about it: https://discuss.gradle.org/t/android-defaultconfig-archivesbasename-deprecated/46384/2

So, the solution:

plugins {
    // your original plugin list
    id 'base'
}

[...]

base {
    archivesName = "${android.defaultConfig.applicationName}-${android.defaultConfig.versionName}"
}

Leave a Comment

Scroll to Top