When I build my Xamarin Android app with Visual Studio 2017 for Mac(7.7.4 build 1), Mono JIT compiler version 5.18.0.248 (2018-08/a4956c837e1 Fri Jan 25 16:13:12 EST 2019) I get the following exceptions:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: The "ConvertResourcesCases" task failed unexpectedly.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: System.IO.IOException: Could not create file "/Users/username/Companymobil/src/Company.Recipes.Droid/obj/Debug/lp/35/jl/res/values-ca/values-ca.xml" or "/var/folders/b5/821mhz8n0px17rnxglrjq5mc0000gp/T/tmp565e9644.tmp". File already exists.
/var/folders/b5/821mhz8n0px17rnxglrjq5mc0000gp/T/
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) [0x00193] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/File.cs:111
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Xamarin.Android.Tasks.ConvertResourcesCases.FixupResources (Microsoft.Build.Framework.ITaskItem item, System.Collections.Generic.Dictionary`2[TKey,TValue] acwMap) [0x00204] in <78f051a6e2064f849cc3ee585300af39>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Xamarin.Android.Tasks.ConvertResourcesCases.FixupResources (System.Collections.Generic.Dictionary`2[TKey,TValue] acwMap) [0x0000f] in <78f051a6e2064f849cc3ee585300af39>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Xamarin.Android.Tasks.ConvertResourcesCases.Execute () [0x000a7] in <78f051a6e2064f849cc3ee585300af39>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:573
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x001f6] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:784
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: The "ConvertResourcesCases" task failed unexpectedly.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: System.IO.IOException: Could not create file "/Users/username/Companymobil/src/Company.ServerAnnouncement.Droid/obj/Debug/lp/15/jl/res/layout/notification_template_icon_group.xml" or "/var/folders/b5/821mhz8n0px17rnxglrjq5mc0000gp/T/tmp4d4475a7.tmp". File already exists.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) [0x00193] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/File.cs:111
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Xamarin.Android.Tasks.ConvertResourcesCases.FixupResources (Microsoft.Build.Framework.ITaskItem item, System.Collections.Generic.Dictionary`2[TKey,TValue] acwMap) [0x00204] in <78f051a6e2064f849cc3ee585300af39>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Xamarin.Android.Tasks.ConvertResourcesCases.FixupResources (System.Collections.Generic.Dictionary`2[TKey,TValue] acwMap) [0x0000f] in <78f051a6e2064f849cc3ee585300af39>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Xamarin.Android.Tasks.ConvertResourcesCases.Execute () [0x000a7] in <78f051a6e2064f849cc3ee585300af39>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:573
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x001f6] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:784
If I click on Build (NOT Rebuild) those exceptions get less every time I build until it finally builds successfully.
If I use jetbrains Rider, the build works every single time.
I gave full permissions (r/w) to everyone on the directories mentioned in the exception and I still get the error. I use APFS case-insensitive.
I would be very grateful for any pointer to solve this.
Thank you very much Leon Lu from Microsoft for pointing me in the right direction. The error stems from a condition in parallel building xamarin android. When parallel builds are disabled, the outcome is the same each time. Parallel builds can be disabled in the Preferences of Visual Studio 2017 for Mac (see attached image).
The issue seems to be fixed (see GitHub link in Leon Lu's comment) and be rolling out in one of the future updates.
Related
After update visual studio version my Xamarin Forms projects not build, showing me the error below. I tried to create a blank app but same error occurs.
Error:
Severity Code Description Project File Line Suppression State
Error The "ManifestMerger" task failed unexpectedly.
System.IO.FileNotFoundException: Could not find file 'D:\GIT\AppBlank\AppBlank\AppBlank.Android\obj\Debug\110\android\AndroidManifest.xml.tmp'.
File name: 'D:\GIT\AppBlank\AppBlank\AppBlank.Android\obj\Debug\110\android\AndroidManifest.xml.tmp'
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
at System.Xml.XmlTextReaderImpl.FinishInitUriString()
at System.Xml.XmlTextReaderImpl..ctor(String uriStr, XmlReaderSettings settings, XmlParserContext context, XmlResolver uriResolver)
at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
at System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext)
at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
at Xamarin.Android.Tasks.ManifestDocument..ctor(String templateFilename)
at Xamarin.Android.Tasks.ManifestMerger.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() AppBlank.Android
Output build:
Rebuild started...
Restored D:\GIT\AppBlank\AppBlank\AppBlank\AppBlank.csproj (in 29 ms).
1>------ Rebuild All started: Project: AppBlank, Configuration: Debug Any CPU ------
Restored D:\GIT\AppBlank\AppBlank\AppBlank.Android\AppBlank.Android.csproj (in 99 ms).
1>AppBlank -> D:\GIT\AppBlank\AppBlank\AppBlank\bin\Debug\netstandard2.0\AppBlank.dll
2>------ Rebuild All started: Project: AppBlank.Android, Configuration: Debug Any CPU ------
2> AppBlank.Android -> D:\GIT\AppBlank\AppBlank\AppBlank.Android\bin\Debug\AppBlank.Android.dll
2>D:\Arquivos de Programas\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1448,3): error MSB4018: The "ManifestMerger" task failed unexpectedly.
2>D:\Arquivos de Programas\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1448,3): error MSB4018: System.IO.FileNotFoundException: Could not find file 'D:\GIT\AppBlank\AppBlank\AppBlank.Android\obj\Debug\110\android\AndroidManifest.xml.tmp'.
2>D:\Arquivos de Programas\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1448,3): error MSB4018: File name: 'D:\GIT\AppBlank\AppBlank\AppBlank.Android\obj\Debug\110\android\AndroidManifest.xml.tmp'
2>D:\Arquivos de Programas\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1448,3): error MSB4018: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
2>D:\Arquivos de Programas\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1448,3): error MSB4018: at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
2>D:\Arquivos de Programas\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1448,3): error MSB4018: at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
2>D:\Arquivos de Programas\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1448,3): error MSB4018: at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
2>D:\Arquivos de Programas\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1448,3): error MSB4018: at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
2>D:\Arquivos de Programas\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1448,3): error MSB4018: at System.Xml.XmlTextReaderImpl.FinishInitUriString()
2>D:\Arquivos de Programas\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1448,3): error MSB4018: at System.Xml.XmlTextReaderImpl..ctor(String uriStr, XmlReaderSettings settings, XmlParserContext context, XmlResolver uriResolver)
2>D:\Arquivos de Programas\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1448,3): error MSB4018: at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
2>D:\Arquivos de Programas\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1448,3): error MSB4018: at System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext)
2>D:\Arquivos de Programas\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1448,3): error MSB4018: at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
2>D:\Arquivos de Programas\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1448,3): error MSB4018: at Xamarin.Android.Tasks.ManifestDocument..ctor(String templateFilename)
2>D:\Arquivos de Programas\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1448,3): error MSB4018: at Xamarin.Android.Tasks.ManifestMerger.Execute()
2>D:\Arquivos de Programas\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1448,3): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
2>D:\Arquivos de Programas\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1448,3): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========
To try correct, I tried downgrade version Xamarin.Forms to 4.6.0.847 version and add tools in AndroidManifest.xml, but not work.
Enviroment:
Microsoft Visual Studio Community 2019 Version 16.10.3 for Windows
Xamarin.Android SDK 11.3.0.4
Xamarin.Forms 5.0.0.2083
Target framework: Android 11.0 (R)
Reproduction:
https://github.com/FlavineiOliveira/AppBlank
Now the problem was solved, but I dont idea as it happened.
Before, I tried:
Clean and rebuild solution
Delete folders bin, obj and rebuild solution
Update and downgrade Xamarin.Forms version
Close and open solution to rebuild
Restart my computer
Repair Visual Studio
Uninstall and install Visual Studio
Now, I just open the solution and try rebuild.
Success.
The environment is same.
I am building an APP using Xamarin / Visual studio for Mac
I have already a project on an Mac mini.
And now I moved that project to an new iMac.
Compile is good. But when trying deploy to a physical device. It got error
"Mono.AndroidTools.AdbException: Attempted to read past the end of the stream"
If I create a new project on the new iMac. It can deploy to the device.
But my old project can't.
Here is some log. I am now stuck at here....Thank you!
80% ... 32128kb of 40140kb copied
90% ... 36160kb of 40140kb copied
100% ... 40140kb of 40140kb copied
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): warning ADB1000: Failed to delete package file: One or more errors occurred. (One or more errors occurred. (One or more errors occurred. (device '9f5f1695' not found)))
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: Deployment failed
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: Mono.AndroidTools.AdbException: Attempted to read past the end of the stream. ---> System.IO.EndOfStreamException: Attempted to read past the end of the stream.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at Mono.AndroidTools.Util.ReadFullAsyncResult.EndRead (System.IAsyncResult ar) [0x00024] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Util/StreamExtensions.cs:95
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at Mono.AndroidTools.Adb.AdbSyncClient.FileWrite_OnReadStatus (System.IAsyncResult ar) [0x0000c] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Adb/AdbSyncClient.cs:619
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: --- End of inner exception stack trace ---
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at Mono.AndroidTools.Util.AggregateAsyncResult.CheckError (System.Threading.CancellationToken token) [0x0002a] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Util/AggregateAsyncResult.cs:72
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at Mono.AndroidTools.Adb.AdbSyncClient.EndPush (System.IAsyncResult result) [0x00006] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Adb/AdbSyncClient.cs:771
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at System.Threading.Tasks.TaskFactory`1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func`2[T,TResult] endFunction, System.Action`1[T] endAction, System.Threading.Tasks.Task`1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/FutureFactory.cs:534
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: --- End of stack trace from previous location where exception was thrown ---
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at AndroidDeviceExtensions.PushAndInstallPackage (Mono.AndroidTools.AndroidDevice device, System.String apkFile, System.String packageName, System.Boolean reinstall, Mono.AndroidTools.Adb.AdbProgressReporter notifyProgress, System.Threading.CancellationToken token) [0x0008f] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:180
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at AndroidDeviceExtensions.PushAndInstallPackage (Mono.AndroidTools.AndroidDevice device, System.String apkFile, System.String packageName, System.Boolean reinstall, Mono.AndroidTools.Adb.AdbProgressReporter notifyProgress, System.Threading.CancellationToken token) [0x003ce] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:203
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at AndroidDeviceExtensions.InstallSharedRuntimeAsync (Mono.AndroidTools.AndroidDevice device, System.String runtimeFile, Mono.AndroidTools.Adb.AdbProgressReporter progress, System.Threading.CancellationToken token) [0x000ac] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:433
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at AndroidDeviceExtensions.InstallSharedRuntimeAsync (Mono.AndroidTools.AndroidDevice device, System.Boolean provideFullDebugRuntime, System.Threading.CancellationToken cancellationToken, Xamarin.AndroidTools.IProgressNotifier progressReporter) [0x000ac] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:630
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at Xamarin.AndroidTools.AndroidDeploySession.CheckAndInstallSharedRuntimeAsync () [0x0009c] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:321
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at Xamarin.AndroidTools.AndroidDeploySession.EnsureCorrectSharedRuntimes () [0x000f2] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:258
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at Xamarin.AndroidTools.AndroidDeploySession.RunAsync (System.Threading.CancellationToken token) [0x001f9] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:198
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at Xamarin.AndroidTools.AndroidDeploySession.RunLoggedAsync (System.Threading.CancellationToken token) [0x0002f] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:123
To resolve issue on my Mac I had to type
adb uninstall Mono.Android.DebugRuntime
sometimes when this bug happens adb was disconnecting from device, and had to type also
adb kill-server
UPDATE:
Another apps would sometimes gave me similar error and uninstalling Mono.Android.DebugRuntime didn't help.
I ran out of ideas and factory reset of my macbook did the trick. No more problems with installing app on devices. Sometimes fresh start is the best way :)
I am using Visual Studio 2022, Windows 10,
Having the same error message, changing USB port or USB cable doesn't work,
Run commands doesn't work:
adb uninstall Mono.Android.DebugRuntime
adb kill-server
But restarting the computer WORKS!
This was fixed by reboot the Mac....
My Xamarin.Android app can no longer be deployed to an emulator/device. I can compile it successfully and the deployment process is started but in the end it fails. I'm using Visual Studio for Mac and Xamarin.Android:
[INSTALL_FAILED_INVALID_APK: Package couldn't be installed in
/data/app/my.app.bundle.id-agudyKm4Ib_8OheG3_5zmg==: Package
/data/app/my.app.bundle.id-agudyKm4Ib_8OheG3_5zmg==/base.apk code is
missing]
My build configuration is below:
Multi-dex = ON because without it I'm getting the DEX size error
DEX compiler = DX (D8 doesn't work, I'm getting a compilation error that some classes are missing, see below)
Code shrinker = Off (this is a debug build to run on local emulator/device)
This error occurs if I set DEX compiler to D8:
R8 : warning : Missing class: androidx.appcompat.widget.AppCompatEditText (and 10 more similar errors)
missing R8 : error : Compilation can't be completed because some library classes are missing.
The error occurs with all the settings above, this is basically the only configuration I can build my app but unable to deploy it to device:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: Deployment failed
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: Mono.AndroidTools.InstallFailedException: Failure [INSTALL_FAILED_INVALID_APK: Package couldn't be installed in /data/app/my.app.bundle.id-agudyKm4Ib_8OheG3_5zmg==: Package /data/app/my.app.bundle.id-agudyKm4Ib_8OheG3_5zmg==/base.apk code is missing]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess (System.String output, System.String packageName) [0x00152] in /Users/runner/runners/2.165.0/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Internal/AdbOutputParsing.cs:341
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at Mono.AndroidTools.AndroidDevice+<>c__DisplayClass95_0.<InstallPackage>b__0 (System.Threading.Tasks.Task`1[TResult] t) [0x00016] in /Users/runner/runners/2.165.0/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/AndroidDevice.cs:753
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at System.Threading.Tasks.ContinuationTaskFromResultTask`1[TAntecedentResult].InnerInvoke () [0x00024] in <f9d1b832704f410aa8ec771f4fe80552>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-10/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: --- End of stack trace from previous location where exception was thrown ---
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at AndroidDeviceExtensions.PushAndInstallPackage (Mono.AndroidTools.AndroidDevice device, System.String apkFile, System.String packageName, System.Boolean reinstall, Mono.AndroidTools.Adb.AdbProgressReporter notifyProgress, System.Threading.CancellationToken token) [0x00189] in /Users/runner/runners/2.165.0/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:187
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at AndroidDeviceExtensions.PushAndInstallPackage (Mono.AndroidTools.AndroidDevice device, System.String apkFile, System.String packageName, System.Boolean reinstall, Mono.AndroidTools.Adb.AdbProgressReporter notifyProgress, System.Threading.CancellationToken token) [0x003df] in /Users/runner/runners/2.165.0/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:203
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at Xamarin.AndroidTools.AndroidDeploySession.InstallPackage () [0x003be] in /Users/runner/runners/2.165.0/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:433
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at Xamarin.AndroidTools.AndroidDeploySession.RunAsync (System.Threading.CancellationToken token) [0x003ae] in /Users/runner/runners/2.165.0/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:217
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at Xamarin.AndroidTools.AndroidDeploySession.RunLoggedAsync (System.Threading.CancellationToken token) [0x0002f] in /Users/runner/runners/2.165.0/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:119
Not a Xamarin expert but if you can see the native files, can you check gradle.properties if it has:
android.useAndroidX=true
android.enableJetifier=true
Also inside the build.gradle of the native files (app directory) you should have:
implementation "androidx.appcompat:appcompat:1.1.0"
Unfortunately the I wasn't able to make it work with DEX Compiler = DX, and when you switch to D8, the migration to AndroidX is required. In terms of Xamarin, you have to add the following package and all additional requested dependencies:
<PackageReference Include="Xamarin.AndroidX.AppCompat">
<Version>1.1.0</Version>
</PackageReference>
Another issue I hit was the usage of old packages.config file which have to be migrated to the project PackageReference. This is not supported from Visual Studio for Mac so you have to switch to Windows to accomplish that tasks. A lot of extra steps just to compile an application in support.
I am trying to build a sample project which can be found at this link https://www.coursera.org/learn/xr-introduction/supplement/cARor/project-work-build-a-vr-application-to-your-device and I am getting this error:
Build completed with a result of 'Failed'
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
UnityEditor.BuildPlayerWindow+BuildMethodException: 4 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x00242] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:194
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x0007f] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:97
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
What to do?
Try to build in a different location? Preferably outside your project folder.
I have VS2010 with nvidia CodeWorks for android, updated with the latest version. My project built fine on ant, but after switching to gradle the following error occurs:
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: The "GradleBuild" task failed unexpectedly.
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: System.InvalidOperationException: Sequence contains no elements
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: at Nvidia.PentaK.Build.Tasks.Android.GradleBuild.GetLatestBuildToolsVersion()
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: at Nvidia.PentaK.Build.Tasks.Android.GradleBuild.WriteBuildFile(AndroidManifest manifest)
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: at Nvidia.PentaK.Build.Tasks.Android.AndroidBuildBase`1.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands)
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: at Nvidia.PentaK.Build.MSBuildInterop.TrackedToolTask.Nvidia.PentaK.Build.MSBuildInterop.ITrackedToolTask.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands)
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: at Nvidia.PentaK.Build.MSBuildInterop.Impl.TrackedToolTaskWrapper`1.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands)
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: at Microsoft.Build.Utilities.ToolTask.Execute()
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: at Microsoft.Build.CPPTasks.TrackedVCToolTask.Execute()
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: at Nvidia.PentaK.Build.MSBuildInterop.ToolTaskBase`2.Execute()
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__1.MoveNext()
5>
I'm not sure what went wrong here- does it fail to find tools (environment variables look correct), or cannot find manifest (same as for ant build, which worked). Tried to reinstall codeworks, but error remains the same. Probably I'm missing some paths or environment variable, but no idea which ones.
The latest CodeWorks have the following components:
android-ndk-r10e
android-sdk-windows
apache-ant-1.8.2
gradle-2.2.1
jdk1.7.0_71
So it seems I can answer that myself...
CodeWorks for Android 1R3 installs the latest version of android build tools into NVPACK\android-sdk-windows\build-tools\android-6.0 folder, where VS tegra plugin cannot find it. (VS tegra plugin was also installed by CodeWorks for Android 1R3, so I was expecting some compatibility between components of same package.) Installing any other build tool version with Android SDK manager (located in NVPACK\android-sdk-windows) solves the issue. Renaming android-6.0 folder to anything like version number x.x.x (i. e. 23.0.2) also works.