Search code examples
xamarinvisual-studio-2015java-opts

What additional java options it is possible to specify in advanced android build settings?


In Xamarin Docs there is JavaOptions packaging property. Its description says "Specifies additional command-line options to pass to java when building the .dex file". But there is no any example. In what form these parameters can be passed? Also JavaOptions can be configured via "Additional Java Options" under android project options. But, again, there is no any examples. It doesn't accept such options like '--no-optimize', 'no-optimize'. So, what kind of format it accepts?


Solution

  • When Xamarin has to start a Java process during the Xamarin.Android MSBuild process, i.e.

    • Proguard
    • JarToXml
    • CompileToDalvik
    • ...

    It will pass those additional cmd-line arguments to java, the most used option is the heap size of the Java process used during a binding project or in Proguard execution, etc..

    -Xmx<size>        set maximum Java heap size
    

    Note: Increasing the Java heap size is common enough that Xamarin provides a separate size option, the value you enter is prefixed with -Xmx and passed as a Java cmd line option.

    Re: https://github.com/xamarin/xamarin-android/search?q=JavaOptions&type=

    From a shell type java -help or java -X, ... to see the various options available for the java process.