Is Androids new Jack compiler really that slow?

喜夏-厌秋 提交于 2019-12-07 15:37:47

问题


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?


回答1:


As per this announcement, the Jack toolchain on Android is deprecated and java8 support will be directly integrated into Android's standard javac and dx toolchain. I switched to Jack for java8 support, but then transitioned to retrolambda because Jack was so slow.



来源:https://stackoverflow.com/questions/41976981/is-androids-new-jack-compiler-really-that-slow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!