应用程序不会覆盖现有的应用程序

时间:2017-11-30 06:58:33

标签: android

清单

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.pvijayalakshmi.previousversion">

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

成绩档案

apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "27.0.1"
defaultConfig {
    applicationId "com.example.pvijayalakshmi.previousversion"
    minSdkVersion 15
    targetSdkVersion 26
    versionCode 2
    versionName "1.1"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.+'
testCompile 'junit:junit:4.12'
}

我开发了一个应用程序。我把它安装在手机上。

现在我需要在我的应用程序中添加一列。我在数据库中添加了一列。我对onUpgrade()进行了更改。我已将数据库版本从1更改为2.

我更改了gradle文件中的版本代码和版本名称。

我不想卸载该应用并重新安装。我想自动升级应用程序。

现在我正在尝试在手机中安装我的应用程序(在向数据库添加列之后),之前的应用程序也存在。

我需要升级我之前存在的应用程序。但我在这里遇到问题。本应用程序不会覆盖以前的应用程序。这两个应用程序包名称都相同。

我怎样才能克服这一点。我需要程序化的解决方案。

例如,我们有许多应用程序,如whatsapp。他们对应用程序和版本进行了更改。因此,我们直接更新到新版本,而不卸载我们现有的whatsapp。就像我明智的那样。

任何帮助都将不胜感激。

当我尝试安装应用程序时,它显示为这样。

image

5 个答案:

答案 0 :(得分:0)

转到移动设置选项

下的开发人员选项

然后,启用这些都是

  1. USB调试

  2. 通过USB安装

  3. 通过USB验证应用

  4. 这些都应该是启用模式(选中模式)

    然后你必须尝试..

答案 1 :(得分:0)

  1. 您可以确保卸载一次。
  2. 您可以清除手机上的缓存。关闭手机后,您可以再次尝试安装。
  3. 如果上述方法不起作用,您可以尝试创建已签名的APK文件并安装一次。
  4. 再次清除项目......

答案 2 :(得分:0)

如果手机中现有的已安装应用已签署APK ,则覆盖新的APK就意味着无需卸载旧版本的新APK,您必须在SD卡中安装已签名的新APK安装之后。 会有效。

答案 3 :(得分:0)

答案 4 :(得分:0)

您可能想要禁用即时运行bob.common=goat bob.have=I have a {0}! bob.want=I want a {0}! bob.need=I need a {0}!

enter image description here

再次

清除重建项目

如果您使用的是miui手机,请关闭MIUI优化

<spring:message code="bob.common" var="animal"/> <spring:message code="bob.have" arguments="${animal}"/> <spring:message code="bob.want" arguments="${animal}"/> <spring:message code="bob.need" arguments="${animal}"/>

相关问题