简体   繁体   English

重新安装Android Studio后无法在设备模拟器上运行应用

[英]Can't run app on device emulator after Android Studio reinstall

I formatted my PC recently but saved my android studio projects to stick. 我最近格式化了我的电脑,但保存了我的android studio项目以保留下来。 I've now installed android studio on my fresh copy of windows and it runs fine and opens up the projects that I had previously saved. 我现在在新的Windows副本上安装了android studio,它可以正常运行并打开我之前保存的项目。

The problem comes when I try to run the app on the device emulator I receive the error: 当我尝试在设备仿真器上运行应用程序时,出现了问题:

Installation failed with message: 安装失败并显示以下消息:

Invalid File: C:\\Users******************\\app\\build\\intermediates\\split-apk\\debug\\slices\\slive_5.apk. 无效的文件:C:\\ Users ****************** \\ app \\ build \\ intermediates \\ split-apk \\ debug \\ slices \\ slive_5.apk。

To clarify, my app is open in android studio. 澄清一下,我的应用程序已在android studio中打开。 I click on "run app" and the emulator opens as normal but the app does not load and I receive the above error. 我单击“运行应用程序”,模拟器将正常打开,但该应用程序未加载,并且收到上述错误。

Any ideas? 有任何想法吗?

Make sure you are using a supported API for the emulator and your project, also try to disable de Instant Run Feature, this issue is been reported in google forums regarding conflicts with gradle and Instant Run 确保您使用的模拟器和项目使用受支持的API,还尝试禁用de Instant Run功能,此问题已在google论坛中报告,关于与gradle和Instant Run冲突

Try: app-debug.apk from command line by: 尝试:从命令行通过以下方式执行app-debug.apk:

adb install -d E:\\Android_Projects\\yourproject\\app\\build\\outputs\\apk\\app-debug.apk 亚行安装-d E:\\ Android_Projects \\ yourproject \\ app \\ build \\ outputs \\ apk \\ app-debug.apk

Also try to disable Instant Run: 也尝试禁用即时运行:

File > Settings > Build,Execution,Deployment > Instant Run > Un-check (Enable Instant Run to hot swap code) 文件>设置>构建,执行,部署>即时运行>取消选中(启用即时运行以热插拔代码)

Multidex applications may also give a similar error while loading on emulator. 在仿真器上加载时,Multidex应用程序也可能会给出类似的错误。 Reducing method count by optimizing dependencies could also help. 通过优化依赖关系来减少方法数量也可能有所帮助。

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

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