Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6135355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:28:09+00:00 2026-05-23T17:28:09+00:00

In my Android app I: generate an incrementing build number (integer) using a script

  • 0

In my Android app I:

  • generate an incrementing build number (integer) using a script as part of my build (uses Integer from SVN revision)
  • I generate an Android resource file with it defined as an integer:
    399

  • I show that on the UI using the resource generated above

  • I reference the integer in the Manifest for the versionCode element

All that works fine, but when I attempt to upload to Market I get this error:

“The file is invalid: ERROR getting ‘android:versionCode’ attribute: attribute is not an integer value “

Question:
For Market, does the versionCode have to be a “literal” integer directly inside the manifest, or is there some way to reference an externally generated integer and not be touching my manifest all the time (manually or automatically).

thanks
(BTW: I have just realized that scheme might cause me issues with patch releases, so I will probably generate a bigger number or something, but would still like the answer to this question)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:28:10+00:00Added an answer on May 23, 2026 at 5:28 pm

    In the end, this is what I have done:

    I create a tag in my version control system with the numbe rof the release in this format

    X.YY.ZZ where they are all integers, like 1.20.00, and reserve the last two digits for unplanned patch releases maybe made on a branch after a later release is made….

    So if I release 1.20.00 then 1.23.00, I can still go back and do a patch release to 1.22.00 called 1.22.01.

    I have a build step that gets the tag name and generates a string resource “1.22.00” for Android that I use in the UI. It also generates it as a number 12200 and I use this as the version number.

    BUT, I don’t try and include this version number directly in the manifest, I set it for the package by setting an ant property for version code that the ant build picks up if defined and uses to create the .apk.

    So I get an always increasing integer for Android Market, but a user with an older version can install a patch release, but you cannot install a patch release if you have a newer official release.

    i.e. if you have 1.20.00 you can install patch 1.20.01, but if a user has moved onto 1.23.00 they cannot install the 1.20.01 patch…

    To set the property you can use;
    project.setProperty(“version.name”, versionName);
    project.setProperty(“version.code”, versionCode);

    if those properties are set, then the Android build system (both old and newer) will pick-up the property value and use it, no need to do anything else special.

    Just make sure you set it using one of the pre-build/pre-compile ant extension points.

    In the new build system (Platform Tools >= 12) in custom_rules.xml I have added

    <project name="custom" default="help">      
        <import file="build_info.xml" />
        <target name="-pre-build" depends="build-info" />
    </project>
    

    where build_info is my own ant project that calculates the version name/number from the Tag name (if you are building in a tag….).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an Android app and a Web Service. We want to download part
I want my Android app to take a picture, as part of something larger
I am working on sending Meeting Invites from my Android app. Here is the
I have a fairly simple android app, it gets protobuf data from a web
My android app was able to generate text files with key value pairs. Now,
Trying to create an android app with Facebook integration, I've gotten to the part
I'm creating a simple Android App, it will be a map with a number
In android app, I need to dynamically generate html and load that into webview
I have made an Android app where items can be purchased using in-app-billing .
I have Phonegap's Facebook plugin working perfectly within my Android app. This plugin uses

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.