5

I have a project with about 20 modules inside. Gradle clean takes about 5min. As ell if i add a new module gradle update projects needs more than 5min.

There are no dependencies to external libraries. Dependencies are only inside the project between several modules.

I had same Project without gradle and it worked fine. I did not convert the old project to gradle. I have created a new project with the file structure recomended by gradle. But with this performance this is not very usefull...

Any idea what's going wrong with gradle?

4

6 回答 6

8

只需在以下目录中创建一个名为 gradle.properties 的文件:

/home/<username>/.gradle/ (Linux)
/Users/<username>/.gradle/ (Mac)
C:Users<username>.gradle (Windows)

将此行添加到文件中:

org.gradle.daemon=true

资料来源:https ://www.timroes.de/2013/09/12/speed-up-gradle/

于 2014-03-12T11:18:07.377 回答
3

我在 Ubuntu 中的 Android 工作室太慢了,我做了这些事情来加快速度。在欢迎屏幕中单击(您也可以通过文件>关闭项目转到它)

 >configure>project default>
>code style > compiler > 
  click the following options 
     -make project automatically
     -use in process build
     -configure on demand
then in compiler (below the first one)
     - give build process heap size as 1000 or 1500
       (it will take a lot of RAM but Android studio will be extremely fast)
       give the same heap size for Android build and gradle build in the below tabs

希望它会有所帮助

于 2014-07-31T09:51:46.993 回答
2

这也有帮助:

如果您注意到 Android Studio 运行缓慢,请考虑减少受防病毒保护的文件夹数量的可能性。

项目中的每次防病毒检查都会消耗资源。如果您从防病毒保护中排除某些文件夹,您可以显着提高性能。

来源:来自 Android Studio 的每日提示。

编辑:2019 年 Google I/O 演讲中也提出了同样的观点:https ://youtu.be/8rfvfojtRss?list=WL&t=756

于 2014-09-17T10:37:15.207 回答
1

在 Help-->EDIT Custom VM options 中设置 Custom VM options。

-Xms1024m
-Xmx2048m
-XX:MaxPermSize=1024m
-XX:ReservedCodeCacheSize=256m
-XX:+UseCompressedOops

文件-->设置-->构建执行

编译器--> 命令行选项集--offline

Gradle-->检查 OfflineWork。

启动 SDK 管理器-->下载 HAXM 安装程序。

现在,Android Studio 在 Windows 中的工作就像魅力一样。快乐编码:)

于 2016-11-08T07:44:31.257 回答
0

在 Windows 上,我发现我的反间谍软件将 jar 文件视为存档。所以我已经将它们排除在扫描之外,但它不是很安全....

于 2014-02-21T10:35:11.433 回答
0

I have a MacBook that I use for Android Studio and when I started out it was completely unusable taking 5 to 10 minutes for a build even for the smallest app. The Android emulator still does not work. Two things made the system usable. More memory added - I originally had 2GB and now have 8GB ... and using actual Android hardware connected via USB.

My MacBook spec is as follows - macOS Sierra Version 10.12.3 MacBook (13-inch, Mid 2010) Processor 2.4 GHz Intel Core 2 Duo Memory 8 GB 1067 MHz DDR3 Graphics NVIDIA GeForce 320M 256 MB Serial Number - oops!

The phone I use for build is an LG Sporty using Android 4.4.2 KitKat

Android Studio has the Intel HAXM extensions loaded and switched on.

于 2017-03-24T10:16:00.803 回答