简体   繁体   English

在Google Play上更新Android应用

[英]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. 我想在Google Play上更新我当前的应用程序(已经生产),但是它说我需要更改versionCode-> 1已经存在。 But I changed or added this in the AndroidManifest.xml, also the versionName. 但是我在AndroidManifest.xml中也将其更改或添加到了versionName中。

You must know, I didn't add any versionCode or versionName in my first upload, could this cause the problem? 您必须知道,我没有在第一次上传中添加任何versionCode或versionName,这可能会导致问题吗?

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 更新了AndroidManifest.xml
  • android:versionCode="2" android:versionCode =“ 2”
  • android:versionName="1.0"> android:versionName =“ 1.0”>
  • created a new signed apk 创建了一个新的签名APK
  • tried to upload 尝试上传

Another question: Do I really need to use the same apk-filename? 另一个问题:我真的需要使用相同的apk文件名吗?

xml manifest: xml清单:

<?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; 对于第二个问题-您可以将.apk文件名更改为所需的名称; there's no need to keep it the same. 无需保持相同。

finally it works... 终于可以了...

  1. updated Android Studio to 0.8.0 将Android Studio更新为0.8.0
  2. updated my APIs (to API 20: Android L) 更新了我的API(至API 20:Android L)
    • changed following project settings: (under "File > Project Structure") 更改了以下项目设置:(在“文件>项目结构”下)
    • Compile SDK Version: android-L 编译SDK版本:android-L
    • Build Tools Version: 20.0.0 生成工具版本: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! ;-) ) 更改了图形布局的选定API(请参见下面的链接), 请看此博客 (谢谢Thodoris Bais!;-))

  4. Had to change the build.gradle file and add the correct VersionCode 必须更改build.gradle文件并添加正确的VersionCode

    • this was the reason why I could not generate apk's with different VersionCodes 这就是为什么我无法使用不同的VersionCodes生成apk的原因
    • it was still set to versionCode=1 though in the manifest it was set to two 尽管清单中将其设置为2,但仍将其设置为versionCode = 1

I checked the new apk file with the aapt command and the versionCode was set to 2, finally! 我使用aapt命令检查了新的apk文件,最后将versionCode设置为2!

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? 现在,我的最后一个任务是:我是否总是必须自己更新AndroidManifest.xml和build.gradle文件-它们不应该只是同步吗?

Best regards, Christian 最好的问候,克里斯蒂安

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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