I need to increment versionCode
in signed APK file.
I do following:
apktool d myapk.apk
open
apktool.yml
, incrementversionCode
and saveapktool b
jarsigner
andzipalign
Apk works well on a phone, but versionCode
has not been changed.
Here's apktool.yml
:
version: 2.0.0
apkFileName: iVet.apk
isFrameworkApk: false
usesFramework:
ids:
- 1
sdkInfo:
minSdkVersion: '16'
targetSdkVersion: '21'
packageInfo:
forced-package-id: '127'
versionInfo:
versionCode: '3'
versionName: '1.1'
compressionType: false
sharedLibrary: false
unknownFiles:
VERSION: '8'
Warning: What you are doing will invalidate the signature. You'll have to resign it afterwards to install it, and it won't look like the original dev made it. There's no way around this, except exploits.
You can just put the
versionCode
inAndroidManifest.xml
and it will override the arguments given toaapt
fromapktool.yml
with a warning. I just confirmed this myself.Example changes to
AndroidManifest.xml
:Setting version information: https://developer.android.com/tools/publishing/versioning.html#appversioning
What the
aapt
command would look like if you changedapktool.yml
:It's clear the values in
apktool.yml
are pulled fromAndroidManifest.xml
: https://github.com/iBotPeaches/Apktool/blob/0370416d9029d01f210556ab3662e3fa0f80c239/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/XmlPullStreamDecoder.java#L96For some reason they're not included in the decoded
<manifest>
attribute. This could be a bug.