【问题标题】:App does not overwrite the already existing app应用程序不会覆盖已经存在的应用程序
【发布时间】:2017-11-30 06:58:32
【问题描述】:

清单

<?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。就像我正在努力做的那样。

任何帮助将不胜感激。

当我尝试安装应用程序时,它显示如下。

【问题讨论】:

  • 只需卸载应用程序并再次运行。
  • 你在小米品牌手机上使用?
  • 我不想再次卸载并重新安装我的应用程序。我想覆盖以前的应用程序。@HemantParmar
  • 不,moto g4 plus@Raja
  • 你在 gradle 中的 applicationId 和 AndroidManifest 文件中的一样吗?

标签: android


【解决方案1】:

在移动设置选项下转到您的开发者选项

那么,启用这些都是

  1. USB 调试

  2. 通过 USB 安装

  3. 通过 USB 验证应用程序

这些都应该是启用模式(检查模式)

那你得试试..

【讨论】:

  • 所有这些选项都处于启用模式@Raja
  • 先生,您有什么解决办法吗?@Raja
【解决方案2】:

如果您现有的,即手机中安装的应用程序是签名的 APK,那么覆盖新的 APK 意味着不卸载旧的运行新的 APK,您必须在 sdcard 中安装新的签名 APK 和之后安装。 它会起作用的。

【讨论】:

  • 不是新的APK。它也有相同的包装。 @Dharmishtha
  • @bhavana new APK 表示 app 的新 versionName 和 versionCode。当然是相同的包名。
  • 例如我们有很多类似whatsapp的应用程序。他们对应用程序和版本进行了更改。因此,我们直接更新到新版本,而无需卸载我们现有的 whatsapp。就像我正在努力做的那样。请帮帮我。
  • @bhavana 是的,这正是你想要的。
  • 如何在sdcard中安装?@Dharmishtha
【解决方案3】:
  1. 您可以检查确保卸载一次。
  2. 您可以清除手机缓存。关闭手机后,您可以尝试重新安装。
  3. 如果上述方法不起作用,您可以尝试创建签名的 APK 文件并安装一次。
  4. 再次清空项目...

【讨论】:

  • 先生,我不想卸载我的应用程序。我想更新应用。
【解决方案4】:

【讨论】:

    【解决方案5】:

    您可能想要禁用即时运行Android Studio Settings or Preferences-&gt; Build,Execution,Deployment -&gt; Instant Run.

    clean并再次重建项目

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

    Settings --&gt; Additional settings --&gt; Developer options --&gt; Turn Off MIUI optimization

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-06-22
      • 1970-01-01
      • 2012-08-29
      • 1970-01-01
      • 2012-12-04
      • 2011-08-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多