简体   繁体   中英

Upgraded Android App not Getting New versionName

I am using this code to get the app's "version name" and then send it to my server: String appversion = mContext.getPackageManager().getPackageInfo(act.getPackageName(), 0).versionName;

When I have v1.0 of the app installed on my phone and upgrade the app via Google Play to v1.0.1, the app still sends "1.0" as the versionName .

If I "Force Close" the app and then open it, it still reports "1.0".

If I "Force Close" and "Clear Data", it still reports "1.0".

If I uninstall the app from my phone and then download v1.0.1, only then does the version name gets reported as "1.0.1" .

Any ideas why this would be happening or what I can to do fix the problem?

Edit: This app is one of several targets / apks that are connected to an Android Library. There is a Manifest in the Android Library and a Manifest in each target apk. My understanding is that the each apk will use it's own Manifest (and the incorrect version numbers don't match the number in the library's Manifest either) but I thought I should mention this.

First check this offical help!

You are mentioning versionName, but the thing which helps distinguish app versions is versionCode defined in your manifest file.

So if this is old version manifest:

//...    
package="com.your.app"
android:versionCode="1" 
android:versionName="MyApp V1.0"
//...

... new one should look like this:

//...    
package="com.your.app"
android:versionCode="2" 
android:versionName="MyApp V1.1"
//...

Also notice that google takes 12-48 hours to publish new version online.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM