Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Performance tweaks for Android Studio and Gradl...

Performance tweaks for Android Studio and Gradle by Samuel Dionne

Android Studio is an awesome tool for Android development, but it may be sluggish at times. We’ll explore some of the ways you can tweak it to make it faster. AS is not the only culprit when it comes to performance. Gradle builds are sometimes, nay, always slow but there are some parameters we can use to improve its performance. When everything else fails, raw power does it.

https://gdgmontreal.com/2020/02/11/february-2nd-meetup/

studio64.vmoptions
-Xms3g
-Xmx3g
-XX:NewRatio=3
-XX:ReservedCodeCacheSize=480m
-XX:MetaspaceSize=512m
-Xss16m
-XX:+UseCompressedOops
-Dfile.encoding=UTF
-Dawt.useSystemAAFontSettings=on
-Dsun.java2d.noddraw=false
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-server

gradle.properties
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx2560M -Dkotlin.daemon.jvm.options="-Xmx2560M" -Dfile.encoding=UTF-8
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.caching=true
kapt.incremental.apt=true
kapt.use.worker.api=true
kapt.include.compile.classpath=false

GDG Montreal

February 26, 2020
Tweet

More Decks by GDG Montreal

Other Decks in Technology

Transcript

  1. Here is the content of my studio64.vmoptions # custom Android

    Studio VM options, see https://developer.android.com/studio/intro/studio-config.html -Xms3g -Xmx3g -XX:NewRatio=3 -XX:ReservedCodeCacheSize=480m -XX:MetaspaceSize=512m -Xss16m -XX:+UseCompressedOops -Dfile.encoding=UTF -Dawt.useSystemAAFontSettings=on -Dsun.java2d.noddraw=false -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -server
  2. Here is the content of my gradle.properties android.enableJetifier=true android.useAndroidX=true org.gradle.jvmargs=-Xmx2560M

    -Dkotlin.daemon.jvm.options="-Xmx2560M" -Dfile.encoding=UTF-8 org.gradle.daemon=true org.gradle.parallel=true org.gradle.caching=true kapt.incremental.apt=true kapt.use.worker.api=true kapt.include.compile.classpath=false
  3. 5 Android Studio tips 7 Gradle tips 50k Mac Pro

    Steal CPU and Memory Rent a Big Server
  4. 1. Copy our local files to the server 7. Offline

    mode File > Settings > Build > Gradle 3. Copy the results files locally
  5. - 3x faster incremental build - 5x faster full build

    - Shared C++ cache - Shared Gradle build cache (coming soon) - 6 person team == lot of minutes saved