1

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

ir-tech
  • 298
  • 4
  • 16
  • 3
    Why is versionCode still set to 1? You must increase this for each update. I am surprised that you are even able to upload this to Google Play without any errors. – Code-Apprentice Apr 17 '17 at 03:31
  • @Code-Apprentice honestly my app is only for internal purpose, so i just bulid and send the apk via email. But when it was on version under 0.1.9 never automatically downgrade ? can u explain pls – Aditya Afgan Hermawan Apr 17 '17 at 03:45
  • I do not understand why it would downgrade. I suggest changing the versionCode to see if it fixes the problem. You should also increase the versionCode for each version in the future. – Code-Apprentice Apr 17 '17 at 03:48

2 Answers2

0

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

RAJESH KUMAR ARUMUGAM
  • 1,560
  • 21
  • 35
0

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.