Updated 30 August 2019
As an android developer, we are spending a lot of time looking at your screen and waiting for Gradle build to finish. In the new Android studio, it has been a lot faster than the previous version but still, there is a lot of scopes to fasten it so Let’s Make it Fast by Doing some quick fixes in Android Studio.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
android { buildTypes { release { // Disables PNG crunching for the release build type. crunchPngs false } } // If you're using an older version of the plugin, use the // following: // aaptOptions { // cruncherEnabled false // } } |
3. Instant RUN- instant run creates a lot of problems till Android Studio 3.0, now it is stable and works on devices sdkVersion ≥21. It also has applied changes that will reflect changes directly into the live process rather than restarting the app.
4. Enable Gradle caching-Caching Gradle will caches task outputs from any previous build from any location. set org.gradle.caching= true in Gradle.properties file to enable caching.
1 2 3 |
// To re-enable the build cache, either delete the following // line or set the property to 'true'. android.enableBuildCache=true |
5. Multi-Module Project- Modularity also increase Gradle build time by building modules in parallel.
1 2 3 4 5 6 7 8 9 |
// Add module in build.gradle implementation project(":login") implementation project(":feature1") implementation project(":feature2") // setting.gradle include ':app', ':login', ':feature2', ':feature1', ':feature1app', ':feature2app' |
6. Don’t use dynamic dependency version- It will lead to check studio every time whether a new library version of this is available.
1 2 3 |
//When specifying dependencies, you should not use dynamic version numbers,such as 'com.android.tools.build:gradle:3.+' // Using this feature can cause unexpected version updates and difficulty resolving version differences. |
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
Be the first to comment.