简体   繁体   English

Android Studio:如何强制重新安装(一次禁用一次即时运行)?

[英]Android studio: How to force re-installation (Disable instant run for once)?

I am aware that you can fully disable instant run(the new Android 2.0 functionality). 我知道您可以完全禁用即时运行(新的Android 2.0功能)。 However I do like the feature except in some cases: -When making changes to a layout file, it often does not pick up the changes causing Nullpointer when accessing those resources. 但是,我喜欢该功能,但在某些情况下除外:-对布局文件进行更改时,在访问这些资源时,它通常不会接收到导致Nullpointer的更改。

Is there a way to bypass instant run? 有没有办法绕过即时运行? And force a re-installation? 并强制重新安装?

I do know that changes the AndroidManifest forces this but that's not convenient. 我确实知道更改AndroidManifest会强制这样做,但这并不方便。

Android Studio 2.0, 2.1 and 2.2: Android Studio 2.0、2.1和2.2:

If you need to deploy a clean build, select Run > Clean and Rerun 'app' from the main menu, or hold down the Shift key while clicking Rerun . 如果您需要部署干净的内部版本,请从主菜单中选择Run >“ Clean and Rerun 'app' ,或者在单击“ Rerun ”时Shift键。 This action stops the running app, performs a full clean build, and deploys the new APK to your target device. 该操作将停止正在运行的应用程序,执行完整的构建,并将新的APK部署到目标设备。

See also the Instant Run documentation , paragraph "Using Rerun" 另请参见“ 即时运行”文档的 “使用重新运行”段落

Android Studio 2.3: Android Studio 2.3:

The behaviour of Instant Run has changed in Android Studio 2.3 即时运行的行为在Android Studio 2.3中已更改

跑 Run Force a cold swap and an app restart. Run强制冷插拔,然后重新启动应用程序。 If you make a change to the app manifest or a resource referenced by the manifest, Android Studio always pushes your changes with a full APK reinstall. 如果您对应用清单或清单引用的资源进行了更改,则Android Studio始终会通过完整安装APK来推送您的更改。

应用更改 Apply changes Push certain code and resource changes to your running app without building a new APK—and, in some cases, without even restarting the current activity. Apply changes某些代码和资源Apply changes推送到正在运行的应用程序,而无需构建新的APK,在某些情况下甚至无需重新启动当前活动。

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

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