android - 从设备上卸载应用程序后,如何防止 Android Studio 2.0 执行完整的干净构建?

标签 android android-studio-2.0 instant-run

我一直在使用带有 Gradle 插件 2.0.0-beta5 的 Android Studio 2.0 Beta 5。我启用了 Instant Run 功能,这在我想进行快速更改和测试时非常有用。因为我的项目通常需要 50 秒才能完成一个完整的 :assembleDebug。借助 Instant Run,我能够在大约 10 秒内让更改后的代码在设备上运行。

但是,当我需要从测试设备上删除应用程序并进行全新安装时。当我下次单击“运行”按钮时,Android Studio 总是执行以下操作:

:clean, :generateDebugSources, :generateDebugAndroidTestSources, :prepareDebugUnitTestDependencies, :mockableAndroidJar, :assembleDebug

这很慢。我的项目大约需要 2 分钟。

有没有办法禁止这种行为?或者为什么不可能?

最佳答案

即时运行,为了更快只针对所选设备的 API。

Instant run uses different techniques to perform hot, warm, and cold swaps that are specific to the API level of the target device

Instant run ref.

但是如果你只是需要再次推送 apk,你可以使用 gradle task install...(一般是 install+Flavor+Type 即:installProdRelease installPaidDebug)或者使用 ADB 手动安装你的 APK。

关于android - 从设备上卸载应用程序后,如何防止 Android Studio 2.0 执行完整的干净构建?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35471362/

相关文章:

gradle - Android studio 2.0 gradle transformClassesWithDexForDebug 使用按钮时失败 "run"

Android Studio (3.2.1) Instant Run 不适用于 Jacoco 0.8.2?

android - BootstrapApplication 无法转换为 ApplicationClass

java - 绩效十亿计数器

php - 保存图像异步 CodeIgniter PHP

Android 模拟器 (Android Studio) 主页按钮不工作并提供 logcat - I/WindowManager : Not starting activity because user setup is in progress

android - 如何在 Android 中检测日票

android - 无法在 if 语句中启动 Activity ?

android-studio-2.0 - Android Studio 2.0+ 在 OS X 上崩溃