【问题标题】:Run "Instant Run" from command line从命令行运行“即时运行”
【发布时间】:2016-06-17 16:01:16
【问题描述】:

我正在从 Android Studio 运行我的 Android 应用,Instant Run 启动了,这很棒。我想从命令行运行完全相同的东西。

在 Android Studio 的 Event Log 中,我看到了

22:00:28 Executing tasks: [:app:incrementalDevDebugSupportDex]
22:00:48 Gradle build finished in 20s 286ms
22:00:51 Instant Run applied code changes and restarted the current Activity.

所以,我希望我能够从命令行运行该任务:./gradlew :app:incrementalDevDebugSupportDex。但是没有找到:

FAILURE: Build failed with an exception.

* What went wrong:
Task 'incrementalDevDebugSupportDex' not found in project ':app'.

有没有办法从命令行使用 Instant Run 运行?

【问题讨论】:

    标签: android android-gradle-plugin instant-run


    【解决方案1】:

    目前无法在 Android Studio 之外使用即时运行。这是在 Android 开发者峰会上提到的,但我记不清是在哪个演讲中了。

    【讨论】:

    • 那真是令人失望。我做了OP所做的。他们为什么要把这个功能绑定到一个 IDE...
    • 我相信fireside chat 中提到了它,但我可以快速追踪时间戳
    【解决方案2】:

    您可以像这样从命令行运行即时运行:

    ./gradlew clean :sample-app:assembleDebug -Pandroid.optional.compilation=INSTANT_DEV -Pandroid.injected.build.api=24
    

    【讨论】:

      【解决方案3】:

      到目前为止,这是可能的。您可以运行以下命令来立即运行:

      ./gradlew :app:incremental"buildvarientname"DebugJavaCompilationSafeguard
      

      您也可以通过在运行配置窗口的任务内添加incremental"buildvarientname"DebugJavaCompilationSafeguard,在 gradle 任务中添加相同的内容,

      【讨论】:

      • 为什么我在运行./gradlew :app:tasks时看不到这些任务?
      • 嗯,我也没有在任务中看到它。
      猜你喜欢
      • 2018-01-30
      • 1970-01-01
      • 2014-11-07
      • 2013-10-17
      • 2015-09-01
      • 2016-06-16
      • 2015-04-19
      • 2011-08-04
      • 1970-01-01
      相关资源
      最近更新 更多