Android Studio - 设备已经具有此应用程序的较新版本

问题描述 投票:0回答:1

仅供参考:我正在使用模拟器,因为我没有 Android 设备(我在模拟器上有 Play Store 支持的设备)。

因此,我的设备上有来自 Play Store 的原始应用程序,并且在 Android Studio 中,运行我的应用程序时,我收到以下消息:

The device already has a newer version of this application.

In order to proceed, you will have to uninstall the existing application 

WARNING: Uninstalling will remove the application data! 
Do you want to uninstall the existing application?
    
[OK] [Cancel]

如果我从 Play 商店下载应用程序,然后长按并选择应用程序信息,它会显示

Version 2.0.0

如果我从 Android Studio 运行应用程序,长按并选择应用程序信息,它会显示

Version 3.0.0

So:设备的应用程序版本为 2.0.0,我尝试从 Android Studio 运行版本 3.0.0,并收到该消息。怎么会呢?

这是在我的build.gradle中,不确定你们是否需要知道,但是:

defaultConfig {
    applicationId = "com.xxxxxxx.yyyyyyyyyyyyy.droid"
    minSdk = 33
    targetSdk = 33
    versionCode = 32
    versionName = "3.0.0"

    testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
android android-studio google-play
1个回答
0
投票

更新应用程序时,需要将

versionCode
更改为 +1。

versionCode
中的数字确定一个版本是否比另一个版本新,数字越大表示版本越新。

versionName
参数仅用于向用户显示应用程序的版本。

更详细的信息可以在文档中找到:https://developer.android.com/studio/publish/versioning

© www.soinside.com 2019 - 2024. All rights reserved.