Override Android versionCode property from applied Gradle script

I want to override the Android versionCode property from an applied script file (as to keep the app script clean). This is what i am doing currently (i omitted anything unrelated):


apply from: 'ci.gradle'

android {
    defaultConfig {
        versionCode 1


project.afterEvaluate {
    project.android.defaultConfig.versionCode = 3434

But i still end up with versionCode being 1… What i am doing wrong?