Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Update android version strings
using System.IO;
using System.Text.RegularExpressions;
namespace AndroidAutoIncrementVersion
{
class Program
{
static void Main(string[] args)
{
try
{
string file = @"AndroidManifest.xml";
string text = File.ReadAllText(file);
Regex regex = new Regex(@"(?<A>android:versionCode="")(?<VER>\d+)(?<B>"")", RegexOptions.IgnoreCase);
Match match = regex.Match(text);
int verCode = int.Parse(match.Groups["VER"].Value) + 1;
text = regex.Replace(text, "${A}" + verCode + "${B}", 1);
Regex regex1 = new Regex(@"(?<A>android:versionName=""\d+\.\d+\.)(?<VER>\d+)(?<B>"")", RegexOptions.IgnoreCase);
Match match1 = regex1.Match(text);
int verCode1 = int.Parse(match1.Groups["VER"].Value) + 1;
text = regex1.Replace(text, "${A}" + verCode1 + "${B}", 1);
File.WriteAllText(file, text);
}
catch {}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.