错误弹窗如图:

Installation failed with message Failed to finalize session: INSTALL_FAILED_TEST_ONLY:installPackageLI.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
WARNING: Uninstalling will remove the application data!
Do you want to uninstall the existing application?
1.Clean Project之后再试,如果还不行就在模拟器上面卸载该app。
2解决方法:
1、打开菜单File——Settings——Build,Execution,Deployment——Instant Run
2、不选中Enable Instant Run to hot swap code/resource changes on deploy(default enabled)
3、依次点击Apply——OK,重新运行程序,大功告成。

我使用第一种方式,完美的解决了我自己的问题。
当尝试在Android Studio中运行程序时遇到'Application installation failed'错误,提示INSTALL_FAILED_TEST_ONLY。可以尝试卸载现有应用并重新安装,或禁用Instant Run功能。通过清理项目或关闭Instant Run选项,问题通常能得到解决。

3万+

被折叠的 条评论
为什么被折叠?



