Found the answer after about 20 hours of searching in my project..
So here are the steps to resolve the problem "java.exe" exited with code 2
1) Change the MainDexClasses.bat as described in the link:
http://www.jon-douglas.com/2016/09/05/xamarin-android-multidex/
2) Make sure you have enabled Multidex
Option in your Android Application! Have a look at the .csprj
file if Multidex
is set to true
(in my case it wasn't even if I enabled Multidex
)
3) Add the following part in your AndroidManifest
file
<application android:name="android.support.multidex.MultiDexApplication"></application>
This will tell your Android project to actually use the Multidex-Option given.
After a clean and build I was able to run my application as it is.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…