简体   繁体   English

卸载apk的现有版本(如果存在),然后重新安装

[英]uninstalling an existing version of the apk if it is present and then re-installing

I am facing an issue with Instant Run when using an Emulator. 使用仿真器时,即时运行遇到问题。 I follow the directory and delete that "slice_8" But it's still The Same Error Message ?! 我按照目录删除"slice_8"但它仍然是同一错误消息?!

Any ideas how I can solve it? 有什么办法可以解决吗?

这是在Android Studio中使用模拟器即时运行时的错误

  1. Disable(uncheck) instant run in settings > build,execution,deployment > Instant run settings > build,execution,deployment > Instant run禁用(取消选中) settings > build,execution,deployment > Instant run

  2. then clean your project in Build > clean project 然后在“ Build > clean project

  3. if still problem not solved, then build > make project 如果仍然没有解决问题, then build > make project

  4. run app 运行应用

Most likely, you installed the currently installed APK from Google Play or some other source that means the certificate used to sign doesn't fully match the existing. 您很可能是从Google Play或其他来源安装了当前安装的APK,这意味着用于签名的证书与现有证书不完全匹配。 A debug and a release certificate is different. 调试和发行证书是不同的。 The solution is simple. 解决方案很简单。 Uninstall it. 卸载它。 Press OK and install the app. 按确定并安装该应用程序。 You can also uninstall it manually from the device/emulator. 您也可以从设备/仿真器手动将其卸载。

If you keep getting the same error even though the certificate is the same, that is a different issue 如果即使证书相同,仍然出现相同的错误,那就是另一个问题

It has to do with the flavors of the app. 它与应用程序的风格有关。 For an instance debug and release. 对于实例调试和发布。 Debug has one certificate, release has a different one. 调试有一个证书,发布有一个证书。 While the package may match, and from the ANdroid OS point of view, these apps are the same. 尽管软件包可能匹配,但从ANdroid OS的角度来看,这些应用程序是相同的。 But the one you install compared to the existing APK. 但是您安装的与现有APK相比。 The apps are the same, but the certificates do not match. 应用程序是相同的,但是证书不匹配。 So you need to uninstall the existing, as you cannot install an APK if there is a certificate mismatch. 因此,您需要卸载现有的证书,因为如果证书不匹配,您将无法安装APK。

If you're using BlueStacks as an emulator, you could go into Settings >> Preferences, then scroll down to Platform Settings and check (enable) "Enable Android Debug Bridge (ADB)". 如果您将BlueStacks用作仿真器,则可以进入“设置” >>“首选项”,然后向下滚动到“平台设置”并选中(启用)“启用Android调试桥(ADB)”。

I assume it's the same type of deal if you are using another emulator, just make sure the ADB is on. 如果您使用的是其他模拟器,我认为这是相同类型的交易,只需确保ADB处于打开状态即可。

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

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