Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle building takes forever after upgrading to Java 8

I tried to enable Java 8 features in Android Studio like suggested in https://android.com:

defaultConfig {
    ...
    jackOptions {
        enabled true
    }
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

After that I added compile 'net.sourceforge.streamsupport:streamsupport:1.5.1' and was able to use lambdas. Since I've done that, the Gradle build takes forever (I killed the process after 20 minutes to try other solutions). My hardware is not pretty good, but still this is not an acceptable time for a build (and it never finished). I also tried to remove this changes, but I face related compilations errors.

I can pull the previous app version from git, but I rather solve these issues to be able to us Java 8 features. Did anyone face this problem and managed to solve it? Thanks.

like image 851
Neria Nachum Avatar asked Sep 26 '16 14:09

Neria Nachum


People also ask

Why does my Gradle build take so long?

Check your Internet connection. If internet speed is very slow gradle build will also take long time to build. I check by change my wifi internet connection with another one good speed connection. Now build time is normal.

Does Gradle work with Java 8?

A Java version between 8 and 18 is required to execute Gradle.


1 Answers

The Jack toolchain is now deprecated, and Java 8 features are available "natively" in Android Studio 3.0.

Rather than trying to get your Gradle builds to go faster with Jack, you should upgrade Android Studio.

like image 94
Stephen C Avatar answered Nov 15 '22 00:11

Stephen C