I made a version of my android app, like 0.1.#
. Now, the version is up to 0.1.9
and the code go like this
defaultConfig {
applicationId "myapp.app"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "0.1.9"
multiDexEnabled = true
}
productFlavors {
demo {
versionName "0.1.9-demo"
}
full {
versionName "0.1.9-full"
}
}
the problem is when it's installed in some device (Huawei Y6 II) its automatically downgrade version to 0.1.6 after one/two days. Maybe this is a rare condition, I already search in google but I couldn't get any answer. pls somebody explain to me, I really appreciate your help. thanks
android:versionCode
An internal version number. This number is used only to determine
whether one version is more recent than another, with higher numbers
indicating more recent versions. This is not the version number shown
to users; that number is set by the versionName attribute. The value
must be set as an integer, such as "100". You can define it however
you want, as long as each successive version has a higher number. For
example, it could be a build number. Or you could translate a version
number in "x.y" format to an integer by encoding the "x" and "y"
separately in the lower and upper 16 bits. Or you could simply
increase the number by one each time a new version is released.
android:versionName
The version number shown to users. This attribute can be set as a raw
string or as a reference to a string resource. The string has no other
purpose than to be displayed to users. The versionCode attribute holds
the significant version number used internally.
Based on this You Should increase the versionCode.
Source : developer.android.com
If your application is a system application that locate in /system/app(or some others system path)
and then you install a newer version with version name(maybe 0.1.9), but the version code same with 0.1.6, system will reset the version to 0.1.6 while the phone restart. Because system think the 0.1.9 and the 0.1.6 is the same version.
SO, you need to increase the VersionCode everytime you release a new version to avoid this problem.