Comments (108)
Same request here.
But I'm using a walkaround that might be useful for someone:
-
Add VERSION_CODE_SHIFT environment variable into your build configuration. Basically, it's the last build number (CFBundleVersion for iOS and android:versionCode for Android) before you moved to App Center CI.
-
Update your appcenter-pre-build.sh (https://docs.microsoft.com/en-us/appcenter/build/custom/scripts/) and following lines there:
For iOS:
VERSION_CODE=$((VERSION_CODE_SHIFT + APPCENTER_BUILD_ID))
plutil -replace CFBundleVersion -string "$VERSION_CODE"
$APPCENTER_SOURCE_DIRECTORY/PATH_TO_YOUR_IOS_PROJECT/Info.plist
For Android:
MANIFEST_PATH="$APPCENTER_SOURCE_DIRECTORY/PATH_TO_YOUR_ANDROID_PROJECT/Properties/AndroidManifest.xml"
VERSION_CODE=$((VERSION_CODE_SHIFT + APPCENTER_BUILD_ID))
sed -i "" 's/android:versionCode="[^"]*"/android:versionCode="'$VERSION_CODE'"/' $MANIFEST_PATH
- There is no need to turn on Automatically increment version code option. APPCENTER_BUILD_ID will be incremented anyway.
from appcenter.
Please implement this asap. For now its not possible to have an automated buildprocess for already existing apps with an higher versioncode.
from appcenter.
Guys, is someone working on this feature? It could be so easy:
- Place a new numeric entry with some basic input validation
- Save button to set the build number manually
- Everyone is happy
from appcenter.
3 years after... I am adding a vote.
from appcenter.
Hey @alexshikov, we see this one as one of the top requested features and are definitely looking at it as we determine priorities each month.
from appcenter.
If it helps anyone, I just brute forced it with a browser script and ran/cancelled the builds to slowly increase the build ID. It's ridiculous solution, but it's the quickest for me right now and doesn't require me to keep maintaining different offsets per product flavor. This is what happens when you ignore blockers in your product for way too long 😄
Heads up, depending on some factors it might get interrupted and not make it to the entire offset, so it will require a few runs to get where you need to be. Just keep an eye on it while it's running. I needed to get to a build number north of 500 and didn't take me that long, surely quicker than me clicking.
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}
async function waitForEl(sel) {
const e = document.querySelector(sel);
if (e) {
return e;
}
await sleep(250);
return waitForEl(sel);
}
async function runOnce() {
const buildButton = await waitForEl('[data-test-id=build-now-button]');
buildButton.click();
const cancelButton = await waitForEl('[data-test-id=cancel-build-button]');
cancelButton.click();
const backButton = await waitForEl('[data-test-id=builds-page] button');
backButton.click();
}
async function run(count) {
for (var i = 0; i < count; i++) {
await runOnce();
}
}
Copy&Paste to console and just run(whatever offset you need)
.
from appcenter.
@nathfy thanks for the pointers. There's a simpler way to do this though. I just added this function to my build.gradle file:
def getVersionCode = { ->
def isAppCenter = System.getenv('APPCENTER_BUILD_ID') != null;
if (isAppCenter) {
try {
def appcenterBuildId = Integer.parseInt(System.getenv('APPCENTER_BUILD_ID'))
def versionCodeOffset = Integer.parseInt(System.getenv('VERSION_CODE_OFFSET'))
return versionCodeOffset + appcenterBuildId
} catch (e) {
// ignore
}
}
return 1 // default
}
Then you can just call the function in your config like so:
defaultConfig {
versionCode getVersionCode()
versionName "1.0"
}
from appcenter.
@nathfy definitely not ignoring this, but having to continually prioritize across the product each month. We do hope to tackle this in the future.
from appcenter.
If you're having trouble with @honzababarik's solution, increase the sleep interval. 500ms worked for me, +150 in no time #21 (comment)
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}
async function waitForEl(sel) {
const e = document.querySelector(sel);
if (e) {
return e;
}
await sleep(500);
return waitForEl(sel);
}
async function runOnce() {
const buildButton = await waitForEl('[data-test-id=build-now-button]');
buildButton.click();
const cancelButton = await waitForEl('[data-test-id=cancel-build-button]');
cancelButton.click();
const backButton = await waitForEl('[data-test-id=builds-page] button');
backButton.click();
}
async function run(count) {
for (var i = 0; i < count; i++) {
await runOnce();
}
}
from appcenter.
Hi @talsemgeest, thanks for this feature request. I can see how this is useful if you aren't starting out from scratch. We'll keep this issue open to track total interest in this ability.
from appcenter.
This might sound super stupid, but after migrating existing project to another App Center profile I recorded mouse movements and simulated amount of manual start build / cancel build actions to match the number of builds I had before.
from appcenter.
If your build runs on App Center and you don't want to follow the workaround suggested above, one lazy way to fix this issue is to build and immediately cancel the build repeatedly until you get to the desired Build ID
from appcenter.
I am sure this is a business decision by Microsoft Product Managers to not allow such a simple feature because they want you to be locked to using AppCenter only, and not other pipelines interchangeably. It's their business, and it's an economic decision. Developers don't call the shots, product managers with dollar sign eyes do.
from appcenter.
you can use the pre build script functionality from appcenter to change your info.plist
something like
PLIST=$APPCENTER_SOURCE_DIRECTORY/......./Info.plist
VERSION="1.0.${APPCENTER_BUILD_ID}"
echo "Setting version to ${VERSION}"
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${VERSION}" $PLIST
from appcenter.
@snios I migrated couple of existing apps to appcenter, some with triple digit build numbers. The workaround is - I still agree - not very cool but it works well. Don't get me wrong: I also want this feature :)
Main thing here is to keep the thread alive, with hope to make this jump up in priority ;D
from appcenter.
The reason all these non-browser-scripting solutions are bad is because it makes appcenter less understandable. appcenter will show you build 1234, but you have to KNOW that corresponds to an output build of 123400 or 1234+5678. That's bad. The fact that this issue has persisted for so long tells you all you need to know about how Microsoft views appcenter. It's a shame, because there aren't clearly better alternatives, yet.
from appcenter.
Any updates on this ?
from appcenter.
Same request, I had to reset the build parameters after a repo change, and now the incremental build id is back at 1 too.
EDIT: apparently after building it goes back to the correct number
from appcenter.
Our app is already in the store and has build numbers history. Now there is no easy way to set base build number apart from writing custom pre-build scripts :(
from appcenter.
Hey @DominicCabral, no definite update for this month's iteration plan, but we intend to get to this very soon. Thanks for your patience!
from appcenter.
@snios I migrated couple of existing apps to appcenter, some with triple digit build numbers. The workaround is - I still agree - not very cool but it works well. Don't get me wrong: I also want this feature :)
from appcenter.
build and immediately cancel the build repeatedly until you get to the desired Build ID
We all know this. We are looking for a permanent fix not workarounds. And if your currently on build number 10xxx good luck with that.
from appcenter.
I am on the exact same situation. Move the existing app build automation to App Center
from appcenter.
Same request here.
from appcenter.
Same here. We are transitioning and existing app to AppCenter and being able to start from our current version number is absolutely necessary.
from appcenter.
@nrajpurkar how many likes do we need to move this feature to the next stage? :)
from appcenter.
+1
from appcenter.
My company switched to GitLab from a different source provider. It is impossible to switch from source provider without creating a new app and now I can't update the build number offset? Not very user friendly to have us create all kinds of custom solutions for something that should be in the product by default.
from appcenter.
It's been two years, still no changes? The workarounds are painful especially when you work in an agency and have to manage so many mobile projects. It becomes one of the biggest hurdles for us to switch to appcenter.
from appcenter.
I figured out to Automate Build numbering & App versioning for Android WITHOUT shell scripting while using Microsoft AppCenter CI/CD pipelines!
You can create environment variables and then use them in the build.gradle file like this:
versionCode System.getenv("VERSION_CODE") ? System.getenv("VERSION_CODE").toInteger() : 201
versionName System.getenv("VERSION_NAME") ? System.getenv("VERSION_NAME").toString() : "1.2.1"
from appcenter.
Hey @DominicCabral, no definite update for this month's iteration plan, but we intend to get to this very soon. Thanks for your patience!
Remaining patient. :-)
from appcenter.
very interested in this one. i have 4 builds that are typically released together to qa. they all have different builids; would be nice to reset them all to a certain value so they would remain in sync.
from appcenter.
Hey @nrajpurkar, any update on this? 😄
from appcenter.
This is preventing us from using the distribute to app store functionality, that wou would love to use!
from appcenter.
just been directed here by app center support, pointing at the workaround above (#21 (comment)) @nrajpurkar can you update us with progress on this?
from appcenter.
Any update on this? I want to move on appcenter an existing app, and this is a blocker.
from appcenter.
Jumping on this as well. I can not use app center for an old project because of this
from appcenter.
Up
from appcenter.
Up
from appcenter.
As app center are ignoring this, here is the solution I am using. It's based on @dkornev one. We are android only at the moment, so only tested there. Should work for IOS with some teaks:
- Add VERSION_CODE_SHIFT environment variable into your build configuration. Basically, it's the last build number (android:versionCode for Android) before you moved to App Center CI.
- Add an
gradle.properties
file with your version details, next to the build.gradle:
VERSION_NAME=3.0.0
VERSION_CODE=279
- Update build.gradle to use the variables from the gradle.properties:
defaultConfig {
versionCode Integer.parseInt(VERSION_CODE)
versionName (VERSION_NAME+VERSION_CODE)
}
- Add an appcenter-pre-build.sh (https://docs.microsoft.com/en-us/appcenter/build/custom/scripts/):
#!/usr/bin/env bash
# This updates the version number to be the build id from app center + the shift up to the build number from the google play store
# Currently we don't shift the ios version number.
PROJECT_NAME=NameOfProjectOnAppCenter
ANDROID_GRADLE_FILE=$APPCENTER_SOURCE_DIRECTORY/NameOfProjectOnAppCenter/android/app/gradle.properties
INFO_PLIST_FILE=$APPCENTER_SOURCE_DIRECTORY/NameOfProjectOnAppCenter/ios/$PROJECT_NAME/Info.plist
VERSION_CODE=$((VERSION_CODE_SHIFT + APPCENTER_BUILD_ID))
echo "Looking for $ANDROID_GRADLE_FILE to update build version";
if [ -e "$ANDROID_GRADLE_FILE" ]
then
echo "Updating version code to $VERSION_CODE in $ANDROID_GRADLE_FILE"
sed -i "" 's/VERSION_CODE=[0-9]*/VERSION_CODE='$VERSION_CODE'/' $ANDROID_GRADLE_FILE
echo "File content:"
cat $ANDROID_GRADLE_FILE
fi
from appcenter.
@kuhnza thanks it works, have you also workaround for iOS?
from appcenter.
@miroslavdurkovic sorry no. Only needed to solve it for Android at this point because previous versions were blocking me from publishing to App Store.
I suspect there’s a way to do it with Xcode’s build scripts though.
from appcenter.
@nilofer maybe there is some update on this?
from appcenter.
tapping in @elamalani for this
from appcenter.
Would be really useful indeed
from appcenter.
This might sound super stupid, but after migrating existing project to another App Center profile I recorded mouse movements and simulated amount of manual start build / cancel build actions to match the number of builds I had before.
Although not ideal at all, only workaround I‘ve heard so far the we could make use of.
@nilofer do you have any updates regarding this feature or an alternative workaround?
from appcenter.
@kuzzmi @LucBas Have you tried any approaches like @TomBruyneel's?
PLIST=$APPCENTER_SOURCE_DIRECTORY/......./Info.plist
VERSION="1.0.${APPCENTER_BUILD_ID}"
echo "Setting version to ${VERSION}"
Appending the APPCENTER_BUILD_ID value to your normal defined version would give you that kind of unique identifier per build. Plus, having the build number at the end of a semantic version is a pretty typical versioning standard, like so:
(1.0.0.324)
(Major.Minor.Patch.Build)
More info on the environment variable here: https://docs.microsoft.com/en-us/appcenter/build/custom/variables/
And on Build scripts here: https://docs.microsoft.com/en-us/appcenter/build/custom/scripts/
from appcenter.
@King-of-Spades unfortunately this workaround is not valid for my case. Because if I transfer the app to another account, I get the same kind of issue - build number won't be unique, because it starts from 1. Although we could bump the version in the plist file, but that requires me to change source code, what I expect not to happen here.
However, in general, Major.Minor.Patch.Build even can be one of the options in App Center - to have this kind of rule in addition to timestamps. But that's a bit different story.
from appcenter.
@King-of-Spades unfortunately this workaround is not valid for my case. Because if I transfer the app to another account, I get the same kind of issue - build number won't be unique, because it starts from 1. Although we could bump the version in the plist file, but that requires me to change source code, what I expect not to happen here.
However, in general, Major.Minor.Patch.Build even can be one of the options in App Center - to have this kind of rule in addition to timestamps. But that's a bit different story.
Just create simple post clone script and that's it
from appcenter.
@alexandrius I guess the whole topic is about being able to do this in the UI, not the possibility to do this in general with workarounds, but thanks.
from appcenter.
@alexandrius I guess the whole topic is about being able to do this in the UI, not the possibility to do this in general with workarounds, but thanks.
You are right sorry I thought this was different issue
from appcenter.
Yeah, I was only trying to highlight workarounds that might be less painful & more viable, I realize they don't really "fix" the issue but in some cases might be sufficient.
from appcenter.
any updates on this feature/issue?
from appcenter.
Adding a vote here.
from appcenter.
And another
from appcenter.
This would be really useful for apps that are already published.
from appcenter.
Adding one more request. here. Setting a base version of the build
from appcenter.
Add Other, please add ASAP
from appcenter.
More than a year passed/
from appcenter.
The script above half worked for me, I couldn't get it to do more than 3 at a time before bugging out. It still saved me a lot of time bumping 20 versions
Really disappointing we have to use a random script for such a basic feature. Seems like they aren't even pretending it's a priority anymore.
from appcenter.
@nilofer Any updates on this?
from appcenter.
I no longer work on App Center. @elamalani to provide support here.
from appcenter.
If it helps anyone, I just brute forced it with a browser script and ran/cancelled the builds to slowly increase the build ID. It's ridiculous solution, but it's the quickest for me right now and doesn't require me to keep maintaining different offsets per product flavor. This is what happens when you ignore blockers in your product for way too long 😄
function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)) } async function waitForEl(sel) { const e = document.querySelector(sel); if (e) { return e; } await sleep(250); return waitForEl(sel); } async function runOnce() { const buildButton = await waitForEl('[data-test-id=build-now-button]'); buildButton.click() const cancelButton = await waitForEl('[data-test-id=cancel-build-button]'); cancelButton.click(); const backButton = await waitForEl('[data-test-id=builds-page] button'); backButton.click() } async function run(count) { for (var i = 0; i < count; i++) { await runOnce(); } }
Copy&Paste to console and just
run(whatever offset you need)
.
You are a lifesaver.
from appcenter.
I used @honzababarik's code and it worked. I had to change the timeout to 4000ms though, so it wasn't super fast, but I didn't have to sit and press over 3000 buttons 👍
from appcenter.
Increase the version code and version name in Android with appcenter-pre-build script
- create appcenter-pre-build.sh and place it under a app folder
- Create a environment variable VERSION_CODE and VERSION_NAME in App Center build settings
Note: You have to manually increase the VERSION_CODE and VERSION_NAME in App Center build settings on each release to Google Play Store. If you found any solution to increase the VERSION_CODE and VERSION_NAME after successful build please share.
`
#!/usr/bin/env bash
#This script allows the version code to be changed in an android build.gradle(app directory) file
#Please specify a VERSION_CODE variable and value in the app center build environment variables in
#the app center build settings pane online
#If no VERSION_CODE environment variable is found then the script will exit with
a message to define the version code in app center environment variables
if [ -z "$VERSION_CODE" ]
then
echo "To use this script, define VERSION_CODE in App Center build settings portal under environment variables"
exit
fi
#Identifies the build.gradle file in the app directory
ANDROID_BUILD_GRADLE=$APPCENTER_SOURCE_DIRECTORY/app/build.gradle
if [ -e "$ANDROID_BUILD_GRADLE" ]
then
echo "version code:" $VERSION_CODE
cat $ANDROID_BUILD_GRADLE
echo "Updating version code to $VERSION_CODE in build.gradle file"
#Finds the versionCode in build.gradle and replaces it with the $VERSION_CODE variable
#defined in app center environment variables
sed -i '' 's/versionCode [0-9a-zA-Z -_]*/versionCode '$(($VERSION_CODE))'/' $ANDROID_BUILD_GRADLE
#Displays the newly updated gradle file with updated versionCode
echo "File content:"
cat $ANDROID_BUILD_GRADLE
fi
#change version name
#If no $VERSION_NAME environment variable is found then the script will exit with
a message to define the version code in app center environment variables
if [ -z "$VERSION_NAME" ]
then
echo "To use this script, define VERSION_NAME in App Center build settings portal under environment variables"
exit
fi
#Identifies the build.gradle file in the app directory
ANDROID_BUILD_GRADLE=$APPCENTER_SOURCE_DIRECTORY/app/build.gradle
if [ -e "$ANDROID_BUILD_GRADLE" ]
then
echo "version name:" $VERSION_NAME
cat $ANDROID_BUILD_GRADLE
echo "Updating version name to $VERSION_NAME in build.gradle file"
#Finds the versionName in build.gradle and replaces it with the $VERSION_NAME variable
#defined in app center environment variables
sed -i '' 's/versionName "[0-9.]*"/versionName "'$VERSION_NAME'"/' $ANDROID_BUILD_GRADLE
#Displays the newly updated gradle file with updated versionCode
echo "File content:"
cat $ANDROID_BUILD_GRADLE
fi
`
from appcenter.
Also requesting this functionality.
Please allow us to set a value for the auto increment variable version code
from appcenter.
+1
from appcenter.
Bump! Any update on this?
from appcenter.
Adding a vote. This feature is long overdue.
from appcenter.
Would love to see this feature! Is there any update on it?
from appcenter.
@Babazon this feature would help onbording apps to appcenter which already exist, technically speaking, apps which have build versions >1 published in the stores. So, of course it is an economic business decision (because a) it costs money to develop this feature and b) there is a workaround for it which you c) don’t very often have use to be honest).
One point I don’t really like is that there is almost no communication going on 🤷🏼♂️
from appcenter.
@Babazon this feature would help onbording apps to appcenter which already exist, technically speaking, apps which have build versions >1 published in the stores. So, of course it is an economic business decision (because a) it costs money to develop this feature and b) there is a workaround for it which you c) don’t very often have use to be honest).
One point I don’t really like is that there is almost no communication going on 🤷🏼♂️
"don’t very often have use to be honest"
Well, except for every app we already have developed outside Appcenter. Most of them in other words. And the workaround is not a good option, because it is a workaround.
There is however a script in one of these threads that with little tweaking can start and cancel builds for you. (perhaps not viable if your build number is in the triple digits though.
from appcenter.
+1
from appcenter.
@elamalani any update?
from appcenter.
This issue led me to use timestamp build numbers, but that has problems too, so I created this issue,
#2090
which has just been automatically closed by a bot with no resolution :(
from appcenter.
+1
from appcenter.
+1
from appcenter.
Thanks for the js scripts everyone. If you're having issues with it, also try it in Chrome - it was bugging out in Safari but running perfectly in Chrome.
AppCenter really does need to address this properly however .
from appcenter.
I had not paid attention to @kornev's comment
There is no need to turn on Automatically increment version code option. APPCENTER_BUILD_ID will be incremented anyway.
Which in fact was stopping the solution I had in place because it was enabled.
This was what I ended up with for Android.
build.gradle
//Environment Variables
def envProperties = new Properties()
try {
def envPropertiesFile = rootProject.file("env.properties")
envProperties.load(new FileInputStream(envPropertiesFile))
} catch (FileNotFoundException e) {
logger.info("env.properties file not found")
//Defaults
envProperties['VERSION_BASE_NAME'] = '0.0.0'
envProperties['VERSION_CODE_PREFIX'] = 1
envProperties['APPCENTER_BUILD_ID'] = 1
}
def VERSION_BASE_NAME = System.getenv("VERSION_BASE_NAME") ? System.getenv("VERSION_BASE_NAME") : envProperties['VERSION_BASE_NAME']
def VERSION_CODE_PREFIX = System.getenv("VERSION_CODE_PREFIX") ? System.getenv("VERSION_CODE_PREFIX") as Integer : envProperties['VERSION_CODE_PREFIX'] as Integer
def APPCENTER_BUILD_ID = System.getenv("APPCENTER_BUILD_ID") ? System.getenv("APPCENTER_BUILD_ID") as Integer : envProperties['APPCENTER_BUILD_ID'] as Integer
def FINAL_VERSION_CODE = (VERSION_CODE_PREFIX + APPCENTER_BUILD_ID) as Integer
android {
...
defaultConfig {
setProperty("versionCode", FINAL_VERSION_CODE)
setProperty("versionName", VERSION_BASE_NAME)
setProperty("archivesBaseName", "myapp-v" + versionName + "-" + versionCode)
...
}
...
}
env.properties
file for local settings
VERSION_BASE_NAME=6.0.1-beta
VERSION_CODE_PREFIX=60100
from appcenter.
@nathfy thanks for the pointers. There's a simpler way to do this though. I just added this function to my build.gradle file:
def getVersionCode = { -> def isAppCenter = System.getenv('APPCENTER_BUILD_ID') != null; if (isAppCenter) { try { def appcenterBuildId = Integer.parseInt(System.getenv('APPCENTER_BUILD_ID')) def versionCodeOffset = Integer.parseInt(System.getenv('VERSION_CODE_OFFSET')) return versionCodeOffset + appcenterBuildId } catch (e) { // ignore } } return 1 // default }
Then you can just call the function in your config like so:
defaultConfig { versionCode getVersionCode() versionName "1.0" }
This workaround by @kuhnza worked for me, but I had to change System.getenv('APPCENTER_BUILD_ID')
to System.env.APPCENTER_BUILD_ID
for it to work
def getVersionCode = { ->
def isAppCenter = System.env.APPCENTER_BUILD_ID != null;
if (isAppCenter) {
try {
def appcenterBuildId = Integer.parseInt(System.env.APPCENTER_BUILD_ID)
def versionCodeOffset = Integer.parseInt(System.env.VERSION_CODE_OFFSET)
return versionCodeOffset + appcenterBuildId
} catch (e) {
// ignore
}
}
return 1 // default
}
from appcenter.
I'm wondering if there's any update on this? We're willing to switch to automated AppCenter builds, and also switch to a paid plan. But this seems to be a bit of a killer, since we're having tons of existing apps, and don't want to integrate workarounds for all of them. Any news on this, AppCenter?
from appcenter.
@dani-digital what framework/language are you using to build your app? Check this comment out:
from appcenter.
Thanks @saamerm , that helps for Android. We're having tons of iOS apps also, where this solution won't work, I assume.
from appcenter.
It is really a shame that this has survived this long... you figure it has to be just an admin-tool with a sql statement away from complete, but here we all are doing crazy things. I used the browser script above as inspiration for a headless version. To run it, go in Chrome dev tools and then click the "build" button to get the headers and request (you can use "Copy Node fetch request" to make it easiest. Then substitute the values where appropriate, and run this in node.
const fetch = require('isomorphic-fetch');
const headers = {
// Put all the header values here. Should include "accept", "cookie", "authorization", and etc
};
const baseUrl = 'https://appcenter.ms/api/v0.1/apps/YourOrg/YourApp';
const commitHash = '*** some git hash of the most recent commit which you will see in the BODY of the build request ***';
async function target(targetBuildNumber) {
let current = 0;
let startBuild;
const start = Date.now();
while (current < targetBuildNumber) {
const { buildNumber } = await fetch(`${baseUrl}/branches/develop/builds`, {
headers,
referrerPolicy: 'no-referrer',
body: JSON.stringify({ sourceVersion: commitHash }),
method: 'POST',
})
.then((response) => response.json())
.catch((error) => {
console.error('Build failed', error);
return {};
});
if (!buildNumber) {
continue;
}
// Don't wait on the cancel, keep on going.
fetch(`${baseUrl}/builds/${buildNumber}`, {
headers,
referrerPolicy: 'no-referrer',
body: JSON.stringify({ status: 'cancelling' }),
method: 'PATCH',
}).catch((error) => console.error('Cancel failed', error));
if (current === 0) {
startBuild = buildNumber;
}
current = buildNumber;
const elapsed = Date.now() - start;
const total = ((targetBuildNumber - startBuild) * elapsed) / (current - startBuild);
console.log(
`Build ${buildNumber}/${targetBuildNumber} consumed. Expected completion ${new Date(
start + total,
)}`,
);
}
}
target(20000).then(() => console.log('Done'));
from appcenter.
I made a package for it. You should be able to call it like so:
npx appcenter-build-bot --app [put appcenter url for your app here] --key [put the API key you generated here] build <target-number>
from appcenter.
@nathfy thanks for the pointers. There's a simpler way to do this though. I just added this function to my build.gradle file:
def getVersionCode = { -> def isAppCenter = System.getenv('APPCENTER_BUILD_ID') != null; if (isAppCenter) { try { def appcenterBuildId = Integer.parseInt(System.getenv('APPCENTER_BUILD_ID')) def versionCodeOffset = Integer.parseInt(System.getenv('VERSION_CODE_OFFSET')) return versionCodeOffset + appcenterBuildId } catch (e) { // ignore } } return 1 // default }
Then you can just call the function in your config like so:
defaultConfig { versionCode getVersionCode() versionName "1.0" }
This workaround by @kuhnza worked for me, but I had to change
System.getenv('APPCENTER_BUILD_ID')
toSystem.env.APPCENTER_BUILD_ID
for it to workdef getVersionCode = { -> def isAppCenter = System.env.APPCENTER_BUILD_ID != null; if (isAppCenter) { try { def appcenterBuildId = Integer.parseInt(System.env.APPCENTER_BUILD_ID) def versionCodeOffset = Integer.parseInt(System.env.VERSION_CODE_OFFSET) return versionCodeOffset + appcenterBuildId } catch (e) { // ignore } } return 1 // default }
I just tried your solution but when i try to push release throws me this error
failed with exception "No property named "1.2 + getVersionCode()" exists in the "android/gradle.properties" file.
from appcenter.
I got success doing like this:
`
ext.versionCode = 12009;
def getVersionCode = { ->
logger.quiet(':::getVersionCode ==> invoked')
def buildVersionCode = ext.versionCode; // default
def isAppCenter = System.getenv('APPCENTER_BUILD_ID') != null;
if (isAppCenter) {
if(System.getenv('USER-DEFINED_VERSION_CODE_OFFSET') == null){
throw new MissingPropertyException("Runing inside AppCenter is necessary inform the USER-DEFINED_VERSION_CODE_OFFSET to avoid versionCode issues on Google Play Store.")
}
def appcenterBuildId = Integer.parseInt(System.getenv('APPCENTER_BUILD_ID'))
def versionCodeOffset = Integer.parseInt(System.getenv('USER-DEFINED_VERSION_CODE_OFFSET'))
buildVersionCode = versionCodeOffset + appcenterBuildId
}
logger.quiet(":::getVersionCode isAppCenter ==> ${isAppCenter} FINAL VERSION CODE ==> ${buildVersionCode}");
return buildVersionCode
}
android {
defaultConfig {
........
versionCode getVersionCode()
........
}`
from appcenter.
I made a package for it. You should be able to call it like so:
npx appcenter-build-bot --app [put appcenter url for your app here] --key [put the API key you generated here] build <target-number>
Nice one! Link to @djMax repo
https://github.com/gas-buddy/appcenter-build-bot
Helped me. Full command:
> docker run --rm -it node /bin/bash
(now inside container)
> cd /tmp
> npm i -D appcenter-build-bot
> npx appcenter-build-bot --app https://appcenter.ms/orgs/XXXXXXX/apps/APP.Android/ --key mykey --branch dev build 1337
from appcenter.
+1
from appcenter.
This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs within 15 days of this comment.
from appcenter.
Any updates on an official fix for this?
from appcenter.
For anyone still hoping, give up. It doesn't seem like it's a feature that will become available at all. Just try to find a workaround.
from appcenter.
For anyone still hoping, give up. It doesn't seem like it's a feature that will become available at all. Just try to find a workaround.
Perhaps so. I just like reminding them of their neglect towards one of their promises.
Promise made in 2019
"nilofer commented on Oct 11, 2019
Hey @DominicCabral, no definite update for this month's iteration plan, but we intend to get to this very soon. Thanks for your patience"
from appcenter.
@nilofer
Being patient :)
from appcenter.
It's been 3 yrs and counting. This fix has not sufficed yet.
Is there any hope on this? @appcenter
from appcenter.
It's been 3 yrs and counting. This fix has not sufficed yet.
Is there any hope on this? @appcenter
from appcenter.
It's been 3 yrs and counting. This fix has not sufficed yet.
Is there any hope on this? @appcenter
from appcenter.
@elamalani will there be a fix for this soon? This was promised a very long time ago.
from appcenter.
Exactly @snios! Sometimes people cannot think outside the box, only look at their problems... Manual repairs will never be a solution...
we are developers, we create solutions to make processes faster and more reliable.
This problem is still open today, it's a shame for Microsoft...
from appcenter.
For Christ sake, MSFT....
please find a solution to this for us -:)
it's almost 4 good years.
from appcenter.
Related Issues (20)
- Support for Xamarin.Android 13.2.2.0 so that we can target Android API 34 HOT 5
- Upgrade React Native Android build runners to macOS 12 HOT 2
- Improve Android NDK symbolication documentation - CMake support HOT 2
- Support Android's default native symbol zip format
- Fix on wording
- iOS 17 SDK Support HOT 8
- Add button to download all errors/crashes of an app
- Harsh HOT 1
- Full MAUI support HOT 1
- Appcenter CLI not working HOT 2
- Can't build Xamarin.ios with Xcode 15.1 and SDK 17 HOT 20
- Keep App Center alive HOT 9
- Open Source for Self-hosting AppCenter. HOT 7
- App Center Retirement: How to handle UWP / MAUI Apps? HOT 4
- AppCenter Retirement: How to handle .NET MAUI Apps? HOT 7
- App Center Retirement: How to handle WPF Apps? HOT 2
- App Center Retirement: open-source/license distribution platform? HOT 2
- Appcentar
- App Center Retirement: Redirect appcast url
- App Center Retirement: Application Insights integration HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from appcenter.