Q:

Could not find method versionCode() for arguments [1.1]

I changed versionCode from 1.0 to 1.1 like this:
versionCode 1.1
versionName "1.1"

And now I can't sync the project because it is giving me this error:

Caused by:
  org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException:
  Could not find method versionCode() for arguments [1.1] on
  DefaultConfig_Decorated{name=main, dimension=null,
  minSdkVersion=DefaultApiVersion{mApiLevel=16, mCodename='null'},
  targetSdkVersion=DefaultApiVersion{mApiLevel=28, mCodename='null'},
  renderscriptTargetApi=null, renderscriptSupportModeEnabled=null,
  renderscriptSupportModeBlasEnabled=null,
  renderscriptNdkModeEnabled=null, versionCode=1, versionName=1.10.1,
  applicationId=com.github.fahadmaqsood.likhat, testApplicationId=null,
  testInstrumentationRunner=android.support.test.runner.AndroidJUnitRunner,
  testInstrumentationRunnerArguments={}, testHandleProfiling=null,
  testFunctionalTest=null, signingConfig=null, resConfig=null,
  mBuildConfigFields={CRASH_REPORT_EMAIL_ADDRESS=com.android.builder.internal.ClassFieldImpl@b2244504},
  mResValues={}, mProguardFiles=[], mConsumerProguardFiles=[],
  mManifestPlaceholders={}, mWearAppUnbundled=null} of type
  com.android.build.gradle.internal.dsl.DefaultConfig.

A:

From the official docs, the version code must be a positive integer.
It is usually incremented by 1 every time there is an update.

