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?
Asked
Active
Viewed 429 times
1 Answers
2
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.

SushiHangover
- 73,120
- 10
- 106
- 165
-
So, it looks like i was wrong and JavaOptions isn't able to turn off dx optimization. Is there any way to do this? – ichernob Apr 15 '17 at 09:46
-
@ichernob You would need to modify the MsBuild task, `Xamarin.Android.Tasks.Dx` to pass it additional options. Can I ask why. you are trying to skip dex optimization? – SushiHangover Apr 15 '17 at 15:09
-
i've faced with problem when debug code works approximately 2-3 times faster than release code. Detected code section doesn't contain any DEBUG symbols. Also i've tried to look jit optimized code for release build, but my attempts were unsuccessful. Disassembly window only says that it can't load assembly. So, my only suggestion that there is some code optimization brings performance regression. – ichernob Apr 17 '17 at 08:23
-
@ichernob Only the Java `ACW` classes would be skipped on the optimization as that is the only Java that Xamarin produces... are you looking at C# -> `IL` or Java -> `Dex`? – SushiHangover Apr 17 '17 at 13:55
-
i'm looking the way to try to disable jit optimization. It would be better to disable it for particular methods. – ichernob Apr 17 '17 at 16:37
-
@ichernob In which code? A Java library? your C# code? – SushiHangover Apr 17 '17 at 16:45
-
@ichernob You tag methods with `[MethodImpl(MethodImplOptions.NoOptimization)]` – SushiHangover Apr 18 '17 at 05:57