- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to Speed up Gradle build process in Android Studio?
Before getting info speed up gradle build, we should know that, what is gradle build.Before eclipse, we dont have any automation scripts to build java and XML code to android apk. So that we used commands to generate apk. To optimize this process, gradle build come into the picture. Gradle is automated script to build and generate apk using android studio.
What is Gradle sync ?
Gradle sync is automation process to download dependencies which are declare in gradle file. A simple example as shown below −
How to speed Gradle Build in android?
Step 1 − Open gradle.properties and add the following code as shown below
# Project-wide Gradle settings. # IDE (e.g. Android Studio) users: # Gradle settings configured through the IDE *will override* # any settings specified in this file. # For more details on how to configure your build environment visit # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. org.gradle.daemon = true org.gradle.parallel = true org.gradle.configureondemand = true org.gradle.jvmargs=-Djava.awt.headless = true -Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true
The above code going to increase build JVM MaxPermSize(gives 2GB max memory to JVM complier) and execute in parallel.
Step 2 − Now use the following process to speed up gradle.
Now open File → Setting →Build,Excution,Deployment → Gradle and check offline work as shown below −
Because every gradle going to sync with internet resources. So when you click on offline work, it will sync with offline resources as well.
Step 3 − Now use the following process to speed up gradle.
Now open File → Setting →Build,Excution,Deployment → complier and check all check boxs as shown below −
To Continue Learning Please Login
Login with Google