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

android_set_version_name does not work with Flutter #10

Open
dsgriffin opened this issue May 19, 2021 · 8 comments
Open

android_set_version_name does not work with Flutter #10

dsgriffin opened this issue May 19, 2021 · 8 comments

Comments

@dsgriffin
Copy link

dsgriffin commented May 19, 2021

Using android_set_version_name without options sets versionName to an empty string. If you run it twice it then completely removes the property from gradle.

If you instead try setting a specific version (e.g. android_set_version_name(version_name: '1.0.0')) it sets an invalid raw numeric instead of a string

def flutterVersionName = 1.0.0 // Error's when building - invalid format
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}
@pablopantaleon
Copy link

You need to use something like this:

lane :staging do 
android_set_version_name(
    version_name: '"1.6.3"'
)
android_set_version_code(
    version_code: 18
)
...
..
.

@TheFabbiusCorp
Copy link
Contributor

Thanks, @pablopantaleon, this works! I think we need to update the documentation.

@TheFabbiusCorp
Copy link
Contributor

@dsgriffin @pablopantaleon Please have a look at this PR if you think it's useful or needs additions/updates:
#17

@igorlamos
Copy link
Contributor

@TheFabbiusCorp PR #17 merged – is that the whole solution to this issue so that it can be closed? Thank you!

@TheFabbiusCorp
Copy link
Contributor

@TheFabbiusCorp PR #17 merged – is that the whole solution to this issue so that it can be closed? Thank you!

Well, that PR provides a description to a possible solution. It actually solves the issue, although supporting the use case in the code itself would be the best.

@yoursweetginger
Copy link

@TheFabbiusCorp PR #17 merged – is that the whole solution to this issue so that it can be closed? Thank you!

But it doesn't work, if you're trying to use variable instead of just string.

android_set_version_name(version_name: '"#{version_name}"')

In build.gradle it looks like it

versionName "#{version_name}"

@yoursweetginger
Copy link

@TheFabbiusCorp PR #17 merged – is that the whole solution to this issue so that it can be closed? Thank you!

But it doesn't work, if you're trying to use variable instead of just string.

android_set_version_name(version_name: '"#{version_name}"')

In build.gradle it looks like it

versionName "#{version_name}"

Solution

android_set_version_name(version_name: %Q["#{version_name}"])

@FaisalMohammadi
Copy link

@TheFabbiusCorp PR #17 merged – is that the whole solution to this issue so that it can be closed? Thank you!

But it doesn't work, if you're trying to use variable instead of just string.

android_set_version_name(version_name: '"#{version_name}"')

In build.gradle it looks like it

versionName "#{version_name}"

Solution

android_set_version_name(version_name: %Q["#{version_name}"])

this works for one time. When i run it again it throughs then the same error and the version looks like this in build.gradle ""2.0.0""

Solution for me was that i just put single quotes for version number like this %Q['#{version_name}']

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

6 participants