7

Just upgraded to Android Studio 3.4 and am trying to compile my apks for the first time with it. Seems to be stuck forever at:

enter image description here

Shall I give this up as a bad job, or be patient?

Zoe
  • 27,060
  • 21
  • 118
  • 148
drmrbrewer
  • 11,491
  • 21
  • 85
  • 181
  • I had similar issues. Just updated gradle to 5.2.1 and all issues gone. – Vikas Patidar Apr 23 '19 at 22:14
  • @VikasPatidar I'm confused... in `File > Project Structure > Project` my gradle version is stated as `5.1.1`. But the latest gradle version according to the following is only `3.4.0`: https://developer.android.com/studio/releases/gradle-plugin EDIT aah that's the *plugin*... gradle itself is https://gradle.org/releases/ ... do I update the gradle version just by typing the new version number in `File > Project Structure > Project`? – drmrbrewer Apr 24 '19 at 19:08
  • That's 3.4.0 is gradle plugin version for Android, you need to change only gradle version. from 5.1.1 to 5.2.1 – Vikas Patidar Apr 25 '19 at 12:11
  • https://stackoverflow.com/questions/57736108/proguard-problem-after-updating-to-android-gradle-plugin-3-5 https://stackoverflow.com/questions/51860843/how-to-turn-off-only-the-obfuscation-in-android-r8 – Chaki_Black Sep 04 '20 at 10:12

2 Answers2

10

No, I gave up after 1 hour (had to force close Android Studio), log out and back in again. I then noted that R8 is enabled by default, so I disabled it as per this and now it's back to normal (using ProGuard rather than R8 though).

EDIT I tried enabling R8 again and this time I got an error message Out of memory: Java heap space, with a suggestion to increase the amount of memory allocated to Gradle by using the following line in gradle.properties:

org.gradle.jvmargs=-Xmx1024m

... and it worked! Seems to compile a lot quicker using R8 compared to Proguard.

drmrbrewer
  • 11,491
  • 21
  • 85
  • 181
  • I was using gradle-wrapper.properties instead of **gradle.properties** but this works – pumnao Jul 08 '19 at 09:00
  • Note: This setting can be [defined for different scopes](https://docs.gradle.org/current/userguide/build_environment.html). In particular in can be [defined on system level](https://mrhaki.blogspot.com/2015/10/gradle-goodness-setting-global.html) in the file `gradle.properties` in `GRADLE_USER_HOME` which usually is `USER_HOME/.gradle`. This solution works; I wonder why it is necessary and does not work "out of the box". – user5534993 Nov 26 '19 at 07:13
5

Even after having 16GB-RAM/256SSD/Core-i7 configuration, I ran into similar issue while building project in release mode on Android Studio 3.4 version with gradle-5.1.1, but after updating to gradle-5.2.1 all issues gone. Just go to File menu and open the Project Structure dialog to update the version. enter image description here

Vikas Patidar
  • 42,865
  • 22
  • 93
  • 106
  • I tried upgrading gradle version as suggested, but I still get the `Out of memory: Java heap space` error as per my answer... for me this is only solved by including `org.gradle.jvmargs=-Xmx1024m` in `gradle.properties`. – drmrbrewer Apr 26 '19 at 13:39