How to make gradle build in android project faster

2019-06-04 07:18发布

问题:

Now i have a project. When i build it with ant, it takes only 40 seconds. But when i build it with gradle, it takes me 3 minutes or 4 minutes, which is really to much for me.

How can i fasten my gradle build?

回答1:

It can help you if you run Gradle in daemon mode - https://twitter.com/timbray/status/512368955516657664



回答2:

If you have multiple cores try gradle --daemon --parallel build, otherwise if you lack multiple cores try gradle --daemon --parallel-threads <number of threads you want to spawn> build. I saw a speed improvement of 200% after the first invocation.