Android source code compile error: “Try increasing heap size with java option '-Xmx'”

前端 未结 6 1300
北恋
北恋 2020-12-04 18:40

Error happens when I try to compile Android source code(Sourcecode-version: 6.0.1; RAM: 6G; host system: ubuntu 14.04),log is below:

including ./system/netd/         


        
6条回答
  •  [愿得一人]
    2020-12-04 18:53

    I found this article: Building AOSP 7.x Nougat with only 8 GiB RAM


    on an 8 GiB machine, Max Heap size is less than 2 GiB:

    $ java -XshowSettings 2>&1  | grep Heap
        Max. Heap Size (Estimated): 1.71G
    

    The solution

    Once I understood the problem, it was just a question of changing the default heap size when jack-server is launched. To fix it, you need to edit ~/.jack-settings, and add this line

    JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4096m"
    

    Then, restart jack-server – otherwise if it is running in the background it will continue to use the old Xmx value:

    $ prebuilts/sdk/tools/jack-admin kill-server
    $ prebuilts/sdk/tools/jack-admin start-server
    Launching Jack server java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=/tmp -Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4096m
    -cp /home/chris/.jack-server/launcher.jar com.android.jack.launcher.ServerLauncher
    

提交回复
热议问题