On some of my Android projects I see that building got quite slow since using the new Jack compiler. I need it to use Java 8 features like lambdas.
But the long building time is a bit disturbing. So I set up a new Android project. It contains just a MainActivity
with one button which reacts on your click.
package de.xappo.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View view) {
Toast.makeText(MainActivity.this, "Button clicked!", Toast.LENGTH_LONG).show();
}
});
}
}
There is nothing else except from the layout file which just contains a a TextView
and a Button
within a RelativeLayout
.
As you can see in the picture all the jack gradle tasks together take about 75 seconds. Is this normal? This hole example app builds in less than 22 seconds without jack. So is this big difference normal?
I already managed Java heap size within my gradle.properties
file:
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
Is there still any thing to do to improve jack compiling performance? Or do you know about any updates planned on jack to improve building time?
As per this announcement, the Jack toolchain on Android is deprecated and java8 support will be directly integrated into Android's standard
javac
anddx
toolchain. I switched to Jack for java8 support, but then transitioned to retrolambda because Jack was so slow.