I created a fastlane
task for uploading to the Play Store as follows:
lane :DEPLOY_BETA do
gradle(task: "clean")
version_codes = google_play_track_version_codes(
package_name: "",
json_key: "play_store_service_account_key.json",
)
gradle(
task: "assemble",
flavor: "World",
build_type: "Release",
properties: { "versionCode" => 100 }
)
apk_path = Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]
supply(
apk: apk_path,
json_key: "play_store_service_account_key.json",
package_name: "",
track: "beta",
skip_upload_metadata: true,
validate_only: true,
skip_upload_images: true,
skip_upload_screenshots: true
)
end
The problem is that the property versionCode
doesn't override the versionCode
specified in the flavor(nor defaultConfig). Is this a bug in fastlane? If i don't set the versionCode
in build.gradle
at all it simply adds no versionCode
and fastlane supply will fail.
Can anyone help me out here?
Using the -D command-line option, you can pass a system property to the JVM which runs Gradle. The -D option of the gradle command has the same effect as the -D option of the java command. You can also set system properties in gradle. properties files with the prefix systemProp.
I had the same problem. And you have to use them inside your build.gradle
, something like this:
versionCode project.hasProperty('versionCode') ? project.property('versionCode') as int : 1
versionName project.hasProperty('versionName') ? project.property('versionName') : "No versionName"
I found this comment inside the original pull request. Seems like gradle don't expose those directly and we need to assign them manually (as per this comment).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With