Gradle:assembleDebug在加载应用程序之前需要一些时间

Dio*_*lor 18 android android-studio android-gradle-plugin

我昨天从Eclipse迁移到Android Studio 5.x. 这真好.

然而,当我运行应用程序来编译并将其安装到我的手机中时,它需要比eclipse更多的时间.

我点击运行,它开始制作应用程序.任务说:Grandle: Executing tasks [:mypackage:assembleDebug].完成后说Grandle invocation completed successfully in x min x sec.然后加载它.

问题是它有时可能只需要20秒,但其他时间只需2-3分钟.哪个是烦人的等待时间.是否必须执行此操作才能在每次编译之前始终运行?我可以关闭它还是减少它的时间?

如果这个问题不准确,我很抱歉,但我不熟悉爷爷如何在AS中完全运作.

Yur*_*raj 4

您可以通过在主 gradle.properties 中使用此配置来加快 gradle 的速度(在 Windows 中,您可以在 Mac 中C:\Users\YourUserName\.gradle\/Users/YourUserName/.gradle/Mac 上找到此文件 - 或者创建新的文件,如果不存在):

org.gradle.daemon=true
org.gradle.parallel=true
Run Code Online (Sandbox Code Playgroud)

这就是你现在能做的一切,谷歌在 IO 上表示,他们将尽力让它更快。

还有类似的主题: Android studio Gradle build speed up