Skip to content

Relative version code in Android not working as expected #11

@genaris

Description

@genaris

When following relative strategy for Android, I found that a semantic version 1.77.0 generates a 8128 version code. This is because it encodes it as 017700 in build.gradle, which is parsed as an octal number due to its leading zero.

The real issue comes when our release includes an '8' or '9' digit, e.g. 1.78.0, as it will be encoded as 017800 and this is an invalid octal number, breaking the build.

I'm wondering what's the need of padding the major version to two digits. I understand that it will facilitate parsing afterwards, but would not be enough to parse from the end to start (i.e. we take the last two digits, and that's patch, then the next two and that's the minor, and finally the remainder is the major version). It will make the parsing a bit more complicated but it will not limit major version to two digits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions