简体   繁体   中英

Update Android app on Google Play

of course there are a lot similar questions and I really read through, but none of them completely answered my question:

I want to update my current app (already prod) on Google Play, but it says I need to change the versionCode -> 1 does already exist. But I changed or added this in the AndroidManifest.xml, also the versionName.

You must know, I didn't add any versionCode or versionName in my first upload, could this cause the problem?

Do I have to delete the app now and re-upload it? I surely used the same keystore and credentials

Steps done:

  • updated the AndroidManifest.xml
  • android:versionCode="2"
  • android:versionName="1.0">
  • created a new signed apk
  • tried to upload

Another question: Do I really need to use the same apk-filename?

xml manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ibma.ibmaapp"
    android:versionCode="2"
    android:versionName="1.0">
    <uses-sdk
        android:minSdkVersion="19"
        android:targetSdkVersion="19"
        android:maxSdkVersion="19" />
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.ibma.ibmaapp.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

For the first question - Are you sure you saved the changes to the manifest? Seems silly, but it's a mistake I make all the time. For the second question - You can change the .apk filename to whatever you'd like; there's no need to keep it the same.

finally it works...

  1. updated Android Studio to 0.8.0
  2. updated my APIs (to API 20: Android L)
    • changed following project settings: (under "File > Project Structure")
    • Compile SDK Version: android-L
    • Build Tools Version: 20.0.0
  3. changed the selected API for the graphical Layout (see link below) have a look at this blog (Thank you, Thodoris Bais! ;-) )

  4. Had to change the build.gradle file and add the correct VersionCode

    • this was the reason why I could not generate apk's with different VersionCodes
    • it was still set to versionCode=1 though in the manifest it was set to two

I checked the new apk file with the aapt command and the versionCode was set to 2, finally!

Now my last queston would be: Do I always have to update the AndroidManifest.xml and the build.gradle file on my own - shouldn't they just synchronize?

Best regards, Christian

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