不小心将 android:Versioncode 更改为更高的值,现在怎么办?

Accidently changed android:Versioncode to a higher value, what now?

我一直在将我的 应用程序版本代码更新为 1,2,3.....15 并且上次我不小心将版本代码更改为更高的数字

android:versionCode="165"

这会导致任何问题吗?我看过版本码是用来识别应用程序降级或升级的,所以我下次更新时我会放

android:versionCode="166"

android:versionCode="16"

这个版本码整数有没有限制?如果它只是一个整数,如果我把它写成 1000 或更多会怎样?

正在查看Versioning Your App (Google Dev)

android:versionCode — An integer value that represents the version of the application code, relative to other versions. The value is an integer so that other applications can programmatically evaluate it, for example to check an upgrade or downgrade relationship. You can set the value to any integer you want, however you should make sure that each successive release of your application uses a greater value. The system does not enforce this behavior, but increasing the value with successive releases is normative.

因此,您的问题的答案是否定的。你的版本代码没问题。并且您必须在下次更新时增加您的版本代码(如上所述)。

会是android:versionCode="166"

我认为没有像你说的1000或更多的限制。只需确保下一个更新版本大于上一个。

如果您担心代码为 Integer,那么它的限制将是 2,147,483,647。所以,增加一个会占用你的生命时间。

我到处都看到 android versionCode 最大值是 2,147,483,647 所以 "increment by one would take your life time. " 但是...

我曾经使用这种模式选择我的 versionCode 值:YYYYmmddHHiiss,后跟另外 2 位数字的值(例如,推荐用于 DNS 序列号)。

如果您使用的是 Cordova 或 Phonegap,不要这样做。

他们的构建脚本试图将“0”添加到您的 versionCode,因此可能会使它对于 int 来说太大...例如,today 可能会给 20,150,623,010.

所以构建脚本失败了...