本文介绍了Android Studio 不会安装新的 APK - 旧的 APK 不会在手机上消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用不会更新.它构建并运行,但它是一些旧版本,我所做的更改不计算在内.例如,如果我制作 Toast,它就不会显示.如果我删除现有的,它仍然会显示.

My app won't update. It builds and runs but it's some old version and the changes I've made aren't counted. If I make a Toast for example, it won't show. If I delete an existing one, it will still show.

我已经尝试了以下方法:

I've tried the following already:

  • 在 SDK 管理器中更新 Android Studio 和更新

  • Updating Android Studio and updates in the SDK manager

从我的手机上卸载应用程序并重新安装

uninstalling the app off my phone and reinstalling

清洁

确保Gradle-aware Make"在运行配置中

make sure "Gradle-aware Make" is in run configurations

文件 - 使缓存无效

确保未勾选跳过安装".

make sure "Skip installation" is unticked.

删除项目的build文件夹并重新构建

delete the build folder of the project and rebuilt

adb shell pm clear com.packagename.app - 成功"但未修复

adb shell pm clear com.packagename.app - "Success" but not fixed

adb shell 卸载 com.packagename.app - 成功"但未修复

adb shell uninstall com.packagename.app - "Success" but not fixed

在 build.gradle 中增加 versionCode 和 versionName

Increase versionCode and versionName in build.gradle

更改构建变体

创建一个新项目并复制文件

Making a new project and copying the files

Android Studio 正在设备上安装旧的 apk

我试过在另一部手机上这样做,但它也卡在那个手机上的旧版本上.

I've tried doing it on another phone and it's stuck on an older version on that one too.

推荐答案

我在使用 AndroidStudio Canary 2020.3.1 Canary 2 时遇到了类似的问题.

I had a similar problem with AndroidStudio Canary 2020.3.1 Canary 2.

就我而言,它有助于检查运行/调试配置/始终使用包管理器安装.

In my case it helped to check Run/Debug Configurations/Always install with package manager.

(不过,我可能忽略了这种行为的一些简单原因.)

(I might have missed some simple reason for this behaviour, though.)

这篇关于Android Studio 不会安装新的 APK - 旧的 APK 不会在手机上消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!