1
votes

I have implemented the continuous integration of xamarin.form project with TFS. I am using "Hosted VS2017" as agent queue. Since few days I am facing one issue, my code builds successfully on my machine but not in TFS. Nuget restores successfully but "Build Xamarin.Android Project xyz/xyz.Android/xyz.Android.csproj" fails and it shows me below error

COMPILETODALVIK (0, 0) COMPILETODALVIK(0,0): Error :

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2028,3): Error XA5213: java.lang.OutOfMemoryError. Consider increasing the value of $(JavaMaximumHeapSize). Java ran out of memory while executing 'java.exe -jar "C:\Program Files (x86)\Android\android-sdk\build-tools\26.0.2\lib\dx.jar" --no-strict --dex --output=obj\Release\android\bin obj\Release\android\bin\classes "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v8.0\mono.android.jar" obj\Release__library_projects__\FormsViewGroup\library_project_imports\formsviewgroup.jar obj\Release__library_projects__\HockeySDK.AndroidBindings\library_project_imports\bin\classes.jar obj\Release__library_projects__\Xamarin.Android.Support.Animated.Vector.Drawable\library_project_imports\bin\classes.jar obj\Release__library_projects__\Xamarin.Android.Support.Compat\library_project_imports\bin\classes.jar obj\Relea...

Process 'msbuild.exe' exited with code '1'.

Error XA5213: java.lang.OutOfMemoryError. Consider increasing the value of $(JavaMaximumHeapSize). Java ran out of memory while executing 'java.exe -jar

I increase the heap size to 1G, 2G but none of the solution work for me.

Its properly working on my machine but not working in TFS

Usually, When this kind of error comes into our visual studio it may be solved by rebuilding the project. How to rebuild the project into TFS?

I have tried different possible solutions but can't able to resolve the issue

2
What about selecting the default Hosted agent?Andy Li-MSFT
Are you using "Xamarin.Android" task to build the project? What's the result if you change "MSBuild Architecture" to "MSBuild x64" in the task settings?Eddie Chen - MSFT

2 Answers

1
votes

Please try below items to narrow down the issue:

  • Enable clean source option : Set Clean to True in the first Get Srouces step.
  • Also enable the Clean option in build step.
  • Select the latest JDK version (JDK 8), and select X64 as the JDK Architecture.
  • Reference : Xamarin Android Out of Memory Build Failure to set Allow Large Heap

Then try it again.

If that still not work, you can try to deploy a private agent on Windows, then install/set SDK/components on the private anent machine same as your Develop machine which worked locally. Then select the private agent to build.

0
votes

Use JDK8 and x64 in VSTS build. Only this combination works as of now. JDK9 x64 or JDK x86 doesn't work....