Xamarin Multple Errors | Can't Archive HelloWorld APK

0

First of all it takes 5 mints to archive,
And whenever I Build or archive, Xamarin won't able to do it,
I tried reinstall windows + xamarin + Visual studio
Also tried to find answer on different forums, Didnt get anything, Even I don't change any code in helloworld apk.
My information:

Mode = Release
Target Framework = Android 9.0 PIE

Error1:The executable is not a valid application.
Occurs = Win_10/7_x86_bit + Visual_Studio 2019:

Unhandled exception: System.ComponentModel.Win32Exception (0x80004005): The specified executable is not a valid application for this OS platform.
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at Xamarin.Android.Tasks.CompileNativeAssembly.RunAssembler(Config config)
   at Xamarin.Android.Tasks.AsyncTaskExtensions.<>c__DisplayClass0_1`1.<WhenAll>b__0()  App8.Android            
Error       Unhandled exception: System.ComponentModel.Win32Exception (0x80004005): The specified executable is not a valid application for this OS platform.
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at Xamarin.Android.Tasks.CompileNativeAssembly.RunAssembler(Config config)
   at Xamarin.Android.Tasks.AsyncTaskExtensions.<>c__DisplayClass0_1`1.<WhenAll>b__0()  App8.Android            

1>------ Build started: Project: App8, Configuration: Release Any CPU ------
1>App8 -> C:\Users\Administrator\source\repos\App8\App8\App8\bin\Release\netstandard2.0\App8.dll
2>------ Build started: Project: App8.Android, Configuration: Release Any CPU ------
2>  App8.Android -> C:\Users\Administrator\source\repos\App8\App8\App8.Android\bin\Release\App8.Android.dll
2>C:\Program Files\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2447,3): error XA0000: Unhandled exception: System.ComponentModel.Win32Exception (0x80004005): The specified executable is not a valid application for this OS platform.
2>C:\Program Files\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2447,3): error XA0000:    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
2>C:\Program Files\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2447,3): error XA0000:    at System.Diagnostics.Process.Start()
2>C:\Program Files\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2447,3): error XA0000:    at Xamarin.Android.Tasks.CompileNativeAssembly.RunAssembler(Config config)
2>C:\Program Files\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2447,3): error XA0000:    at Xamarin.Android.Tasks.AsyncTaskExtensions.<>c__DisplayClass0_1`1.<WhenAll>b__0()
2>C:\Program Files\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2447,3): error XA0000: Unhandled exception: System.ComponentModel.Win32Exception (0x80004005): The specified executable is not a valid application for this OS platform.
2>C:\Program Files\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2447,3): error XA0000:    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
2>C:\Program Files\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2447,3): error XA0000:    at System.Diagnostics.Process.Start()
2>C:\Program Files\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2447,3): error XA0000:    at Xamarin.Android.Tasks.CompileNativeAssembly.RunAssembler(Config config)
2>C:\Program Files\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2447,3): error XA0000:    at Xamarin.Android.Tasks.AsyncTaskExtensions.<>c__DisplayClass0_1`1.<WhenAll>b__0()
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Error2:java.exe" exited with code 1
Occurs = Win_7_x86_bit + Visual_Studio 2017:
It was building archive before but not works now.

"java.exe" exited with code 1.  App10.Android           
1>------ Build started: Project: App10, Configuration: Debug Any CPU ------
1>App10 -> C:\Users\Administrator\source\repos\App10\App10\App10\bin\Debug\netstandard2.0\App10.dll
2>------ Build started: Project: App10.Android, Configuration: Debug Any CPU ------
2>  App10.Android -> C:\Users\Administrator\source\repos\App10\App10\App10.Android\bin\Debug\App10.Android.dll
2>  No way to resolve conflict between "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
2>C:\Program Files\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2610,3): error MSB6006: "java.exe" exited with code 1.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I will never use Xamrin again in my life, But due to my project is based on it(libvlcsharp), Feel free to ask any info If I didn't added it. Thanks.

c#
android
visual-studio
xamarin
xamarin.forms
asked on Stack Overflow Jul 31, 2020 by Sorry IwontTell • edited Aug 2, 2020 by Sorry IwontTell

1 Answer

0

Error2:java.exe" exited with code 1
I solved error2 by installing and pointing visual studio to new java development kit path,
Bydefault VS installs it automatically,
So it is recommended to install jdk manually.
https://www.oracle.com/java/technologies/javase-downloads.html
It now works for me in VS17.

Error1:The executable is not a valid application. This error still exists,
May be because now VS19 prefers x64 bit OS like android studio,
So thats why it is installing x64 bit build tools,
Like I can't preview xaml as it says OS should be x64 to view designer.

answered on Stack Overflow Aug 2, 2020 by Sorry IwontTell

User contributions licensed under CC BY-SA 3.0