Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Impossible to find the version code with the specified properties #16

Open
janoist1 opened this issue Feb 13, 2020 · 7 comments
Open

Comments

@janoist1
Copy link

Fastlane is great - when it works. There is always something gets broken, this time "Impossible to find the version code with the specified properties". Any idea why?

@AdamGerthel
Copy link

Your gradle_file_path is probably wrong. If you're running fastlane in the root of the project folder, it's probably gradle_file_path: "app/build.gradle", but if you're running it from a parent folder, which is common in react-native projects, then probably gradle_file_path: "android/app/build.gradle".

@waleedsarwar86
Copy link

waleedsarwar86 commented Mar 22, 2020

I am also getting this error. Here is how my versionCode is defined in project_name/build.gradle file

ext.buildConfig = [
           'compileSdk' : 29,
           'minSdk'     : 19,
           'targetSdk'  : 29,
           "versionCode": 41,
           "versionName": "3.0.0",
           "revisionNumber": 1,
   ]

Here is how I am calling it

increment_version_code(
      gradle_file_path:"./build.gradle",
      ext_constant_name:"versionCode"
    )

@NarHakobyan
Copy link

Same

@MaoTouWang
Copy link

MaoTouWang commented Apr 8, 2021

I have two flavours, in each flavor has its own versionCode, how to define ext_constant_name to increment correct flavor versionCode?

"app/build.gradle" file
productFlavors {

   homeCountry {
        dimension "xxxx"
        applicationId "xxxxxx"
        versionCode 290101001
        versionName "1.1.0"
    }

    internaionalCountry {
        dimension "xxxxx"
        applicationId "xxxxxxxx"
        versionCode 290202004
        versionName "2.2.0"
    }

}

@ella33
Copy link

ella33 commented Sep 14, 2022

+1 for @MaoTouWang's question I'm also wondering how can I increment the version code per flavor.

@tekeroth-snapcode
Copy link

tekeroth-snapcode commented Dec 3, 2022

EDIT:
It seems like I found the culprit? In my build.gradle file, I added a comment, like so:

android {
    ndkVersion rootProject.ext.ndkVersion

    compileSdkVersion rootProject.ext.compileSdkVersion

    defaultConfig {
        applicationId "my.domain.id"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1   // dont touch fastlane override

and after i removed that comment, it works. I hope that helps someone in the future =)


I have the same issue. In this case, it was all working, but the problem in this case seems to be coming from me adding more "tracks" that Fastlane is looking at when determining the latest/highest versionCode on Google Play.

So, it was (and this is working):

private_lane :get_latest_version_code do
    
    internal_build_number = google_play_track_version_codes(
      track: "internal",
      package_name: ENV['BUNDLE_ID'],
      json_key: play_store_key_path
    )[0].to_i

    prod_build_number = google_play_track_version_codes(
      track: "production",
      package_name: ENV['BUNDLE_ID'],
      json_key: play_store_key_path
    )[0].to_i

    [internal_build_number, prod_build_number, ].max
  end

but I needed the "Open testing" track too, so when I checked Fastlane docs, it says that the available "tracks" are "The default available tracks are: production, beta, alpha, internal" (see here), so I changed that code to below, and then it fails with the error as above:

private_lane :get_latest_version_code do
    
    internal_build_number = google_play_track_version_codes(
      track: "internal",
      package_name: ENV['BUNDLE_ID'],
      json_key: play_store_key_path
    )[0].to_i

    prod_build_number = google_play_track_version_codes(
      track: "production",
      package_name: ENV['BUNDLE_ID'],
      json_key: play_store_key_path
    )[0].to_i

    beta_build_number = google_play_track_version_codes(
      track: "beta",
      package_name: ENV['BUNDLE_ID'],
      json_key: play_store_key_path
    )[0].to_i

    alpha_build_number = google_play_track_version_codes(
      track: "alpha",

      package_name: ENV['BUNDLE_ID'],
      json_key: play_store_key_path
    )[0].to_i

    [internal_build_number, prod_build_number, beta_build_number, alpha_build_number].max
  end

The error log (from CircleCI where I build) is looking strange though. Look at this line below: Found ', 300114' version codes in track 'beta'. The versionCode 300114 is correct, but it captures more than that: ', 300114' which of course cannot be cast to a integer. Also, the alpha track seems to return an empty string (since we have nothing in the alpha track).

So, whats going on here?

14:54:22]: Cruising over to lane 'android get_latest_version_code' 🚖
[14:54:22]: ---------------------------------------------
[14:54:22]: --- Step: google_play_track_version_codes ---
[14:54:22]: ---------------------------------------------
[14:54:23]: Found '300113' version codes in track 'internal'
[14:54:23]: ---------------------------------------------
[14:54:23]: --- Step: google_play_track_version_codes ---
[14:54:23]: ---------------------------------------------
[14:54:24]: Found '300113' version codes in track 'production'
[14:54:24]: ---------------------------------------------
[14:54:24]: --- Step: google_play_track_version_codes ---
[14:54:24]: ---------------------------------------------
[14:54:26]: Found ', 300114' version codes in track 'beta'
[14:54:26]: ---------------------------------------------
[14:54:26]: --- Step: google_play_track_version_codes ---
[14:54:26]: ---------------------------------------------
[14:54:27]: Found '' version codes in track 'alpha'
[14:54:27]: Cruising back to lane 'android bump_version' 🚘
[14:54:27]: ------------------------------------
[14:54:27]: --- Step: increment_version_code ---
[14:54:27]: ------------------------------------

@apisitChanyakorn95
Copy link

apisitChanyakorn95 commented Oct 18, 2023

in build.gradle
I only changed
versionCode flutterVersionCode.toInteger()
to
versionCode 1

It's work!

And this is my lane in Fastfile

lane :setBuildNumber do
    previous_build_number = google_play_track_version_codes()[0]
    current_build_number = previous_build_number + 1
    increment_version_code(
      gradle_file_path: "app/build.gradle",
      version_code: current_build_number
    )
  end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants