WARNING Uninstalling will remove the application data!

1,325 阅读1分钟

使用AndroidStudio运行项目,安装debug版本,安装失败,有时候会出现以下的提示信息: Installation failed since the device possibly has stale dexed jars that don't match the current version (dexopt error). In order to proceed, you have to uninstall the existing application. WARNING: Uninstalling will remove the application data! Do you want to uninstall the existing application?

截图:

提示信息
刚刚碰到这个问题的时候,我也是上网搜索答案,一般是说把手机的usb安装管理给关掉,但是我关掉了还是不行。 于是我去AndroidStudio,cleanProject一下,然后运行项目就可以安装了。 也有人说是AndroidStudio带的instant run的bug,把instant run的选项去掉,编译安装成功。

安装成功之后,但是运行app闪退的时候,而且报以下这个错误的时候: Caused by: java.lang.ClassNotFoundException: Didn't find class 这时你需要在build目录下,RebuildProject下就可以,然后运行项目,就不会报ClassNotFoundException这个错误,app不会再闪退。

如果再不行的话,可以参考《Android Studio: Failure INSTALL_FAILED_TEST_ONLY》

即步骤:as导航栏Run---->EditConfigurations----->选择app------>然在Install Flags加上"-t"即可!!!!