Virtually any code change results in the above message when next trying to build. Cleaning before building fixes it. The app is an Android 10 - AndroidX app if that makes any difference.
@gmck
OK. I can reproduce this error with my AndroidX test samples.
Workaround for now: rebuild and then run.
Sole run will cause this error.
Tests continued.
Binlog
Run after code change.
SampleApp.Android.csproj_Evaluation_2019-12-24T10_34_55.7709154+01_00.binlog.zip
After getting error pressing run (install/deploy) again will deploy the new app (with code change).
I'm hitting this in 16.4.2. Rebuild / clean and then redeploy does not fix it. Any ideas on what else to try in order to troubleshoot?
@moljac I am having trouble reproducing this issue on the latest preview version of VS 2019 with your sample app.
Also would you be able to capture the binlog files again? The file in the zip that you linked did not seen to include any information at all.
@mattleibow this project is using AndroidX.Migration, and I am guessing that this target is not running for some reason on some incremental builds:
I suspect AndroidX.Migration is affecting the tree of MSBuild target dependencies? Maybe the $(_CreateBaseApkDependsOnTargets) property is overwritten?
I'm not able to build the linked sample, the NuGets do not restore for me.
@dellis1972 I'm still completely blocked from deploying on the latest VS release. Is there anything I can gather to help figure out what is going wrong here?
Can you attach a diagnostic MSBuild log?
Its annoying bug... once you have to clean and rebuild for every build... should be top priority
Some help I cannot build the project, I have not change anything in the project, just rebuild here is the output
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Error MSB4044: The "CopyGeneratedJavaResourceClasses" task was not given a value for the required parameter "SourceTopDirectory". (MSB4044) (App.Droid)
Build FAILED.
/Library/Frameworks/Mono.framework/Versions/6.6.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(2126,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Mono.Android". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
/Library/Frameworks/Mono.framework/Versions/6.6.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(2126,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Xamarin.iOS". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(404,3): warning XA5302: Two processes may be building this project at once. Lock file exists at path: /Users/mi/Projects/App/Library/obj/Debug/.__lock
/Users/mi/Projects/App/packages/Microsoft.Bcl.Build.1.0.21/build/Microsoft.Bcl.Build.targets(243,5): warning : All projects referencing App.csproj must install nuget package Microsoft.Bcl.Build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317569.
/Library/Frameworks/Mono.framework/Versions/6.6.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(2126,5): warning MSB3277: Found conflicts between different versions of "Microsoft.CSharp" that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1677,2): error MSB4044: The "CopyGeneratedJavaResourceClasses" task was not given a value for the required parameter "SourceTopDirectory".
5 Warning(s)
1 Error(s)
@dellis1972 Tried several variants on the sample mentioned above and I cannot reproduce it anymore.
Sorry. Continuing to migrate other monodroid-samples and if I hit it again I will provide feedback here.
Its annoying bug... once you have to clean and rebuild for every build... should be top priority
@Nyconing you are using AndroidX.Migration, correct? It is still in preview at the moment, but getting close: https://www.nuget.org/packages/Xamarin.AndroidX.Migration/1.0.0-rc1
If someone could send a diagnostic build log, or just a sample project and some repro steps, we could probably fix it. We are having trouble reproducing it. Thanks!
I am also experiencing this - it will failed with this error message on the first build, building again will work.
It appears randomly though...
I managed to figure out what was wrong in our project. We had a custom build task that would update the AndroidManifest.xml file that was placed in the obj folder after the build placed it, and before deployment. Our goal with that was to continually update the build number without changing the AndroidManifest.xml file that is versioned in git.
When I disabled that custom build task, everything started working again. My guess is that touching the file after it was place invalidated some cache or changed it's hash in such a way that the build / deployment couldn't continue successfully. So, if you're touching anything in the obj (or bin?) directory as part of the build, you may be experiencing the same thing I was.
FWIW, this broke for me when I updated to VS 16.4. It worked for years in VS 16.3-ish and below.
@lafritay can you share the MSBuild target? If you are using something in MSBuild prefixed with an underscore, that is a convention for something that is "private". That means we might rename it in a future release.
@jonathanpeppers Here you go. It does look like I'm using something private. Is there something better to use instead there?
<Target Name="UpdateAndroidManifest" AfterTargets="Build" BeforeTargets="_CreateBaseApk">
<ItemGroup>
<AndroidManifestFiles Include="obj\$(Configuration)\**\android\AndroidManifest.xml" />
</ItemGroup>
<PropertyGroup>
<PhonesAssemblyPath>bin\$(Configuration)\myTIPreport.Android.dll</PhonesAssemblyPath>
<PhonesAssemblyPath Condition="'$(IsVSTS)' != ''">$(OutputPath)\myTIPreport.Android.dll</PhonesAssemblyPath>
</PropertyGroup>
<GetAssemblyIdentity AssemblyFiles="$(PhonesAssemblyPath)">
<Output TaskParameter="Assemblies" ItemName="AssemblyInfo" />
</GetAssemblyIdentity>
<PropertyGroup>
<CurrentTime>$([MSBuild]::Divide($([System.DateTime]::UtcNow.Ticks), 10000000))</CurrentTime>
<SecondsSinceBase>$([System.Math]::Floor($([MSBuild]::Subtract($(CurrentTime), 63600000000))))</SecondsSinceBase>
<VersionNumber>$([System.Text.RegularExpressions.Regex]::Match(%(AssemblyInfo.Version), `(\d+)\.(\d+)\.(\d+)\.(\d+)`))</VersionNumber>
</PropertyGroup>
<XmlPoke XmlInputPath="%(AndroidManifestFiles.Identity)" Namespaces="<Namespace Prefix='android' Uri='http://schemas.android.com/apk/res/android' />" Query="manifest/@android:versionCode" Value="$(SecondsSinceBase)" />
<XmlPoke XmlInputPath="%(AndroidManifestFiles.Identity)" Namespaces="<Namespace Prefix='android' Uri='http://schemas.android.com/apk/res/android' />" Query="manifest/@android:versionName" Value="$(VersionNumber)" />
</Target>
Same here. Using VS 16.4.3 and AndroidX. Used AndroidX.Migration (not now). Attaching binary log.
xamarin-android-4068-binlog.gz
@lafritay if you want to keep using that target you can you just need to change when it happens so that the modified dates line up. We have extension points specifically for Manifest modifications see https://github.com/xamarin/xamarin-android/blob/master/Documentation/guides/BuildProcess.md#build-extension-points for more details.
@pulimento thanks I see what is happening from your log:
Skipping target "_PrepareCreateBaseApk" because all output files are up-to-date with respect to the input files.
So then $(AaptTemporaryDirectory) is blank because that target was skipped.
Then hit an error because the SourceTopDirectory property is [Required]:
It looks like this also might happen with $(ResgenTemporaryDirectory): https://github.com/xamarin/xamarin-android/blob/38a10a17eaf16b052e3c5ffbee502565acc688f5/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets#L1578-L1583
It seems like normal builds don't trigger this issue but AndroidX.Migration does. Looking into it.
Awesome @dellis1972! Any schedule for when that fix will be released in VS?
the problem still remains. the project is built now, but the archive still throws the same error
its not yet fix even on preview version, i think it will need few weeks until we can get update.
currently my temporary workaround is modify at lease one android resource before build.
This fix will be in 16.5 Preview 3.
To get a sense when it will go stable, there is not a public release date, but you can look at the pattern of past releases here: https://docs.microsoft.com/en-us/visualstudio/releases/2019/history
Release status update
A new Preview version has now been published that includes the fix for this item. The fix is not yet included in a Release version. I will update this item again when a Release version is available that includes the fix.
The fix is not yet available on macOS. I will update this item again when a Preview version with the fix is available on macOS.
Fix included in Xamarin.Android 10.2.0.99.
Fix included on Windows in Visual Studio 2019 version 16.5 Preview 3. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview.
Fix not yet available on macOS.
Hi @jonathanpeppers and @brendanzagaeski - will this be pushed with the VS 16.4.6 ? Not sure how many 16.5 previews we need to wait running this workaround on a daily basis till then.
Thank you,
Fix included on Windows in Visual Studio 2019 version 16.5 Preview 3. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview.
Fix not yet available on macOS.
Thanks for the info. I tried the current preview build of VS for Mac (8.5.3101) with Xamarin.Android 10.2.0.84, but I still see this issue. Is there any estimate when the fix will be available on MacOS?
I have the same issue ^
Same here,
VS Pro for Mac, 8.4.7 (b17)
Xamarin.Forms 4.5.0.356
"CopyGeneratedJavaResourceClasses" task was not given a value for the required parameter "SourceTopDirectory". MSB4044
I am facing the same issue on VS for Mac 8.4.8, Xamarin.Android 10.1.3.7.
Thanks for looking into this issue.
same issue here too =/, need everytime rebuild the solution, so bad.
Same issue for me too, not blocking but really annoying
This fix will be in 16.5 Preview 3.
To get a sense when it will go stable, there is not a public release date, but you can look at the pattern of past releases here: https://docs.microsoft.com/en-us/visualstudio/releases/2019/history
Hi @jonathanpeppers - fix for such bugs should be released in the GA version first before releasing it to preview. It really takes lot of cycles and time to keep rebuilding.
I opened issue #4370 for the specific VS for Mac bug.
Apologies for the delay between the Windows and macOS preview versions with the fix for this item. The macOS preview version that includes the fix is now available.
Release status update
A new Preview version has now been published on macOS that includes the fix for this item. The fix is not yet included in a Release version. I will update this item again when a Release version is available that includes the fix.
Fix included in Xamarin.Android 10.2.0.100.
Fix included on macOS in Visual Studio 2019 for Mac version 8.5 Preview 6. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel.
(Fix also included on Windows in Visual Studio 2019 version 16.5 Preview 3 and higher. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview.)
Hi @brendanzagaeski , thank you for your help and everyone on the Xamarin Android team.
From the development productivity cycle, this issue has put on a lot of toll on the time it has been taking to do the build. As stated earlier, just curious and somewhat surprising why it is not prioritized to be addressed in the fix pack release of the GA version ?
Thanks
Unfortunately, I don't have too much information about the considerations involved in determining whether this fix could be accepted for inclusion in a servicing update for Visual Studio 2019 version 16.4.
I suspect part of the challenge in this case would have been estimating how many users would want to use Xamarin.AndroidX.Migration before the Visual Studio Studio 2019 version 16.5 release, and estimating how many of those users might already be using Visual Studio 2019 version 16.5 Preview for projects involving AndroidX. But I'm not sure if those were the main considerations.
Unfortunately, I don't have too much information about the considerations involved in determining whether this fix could be accepted for inclusion in a servicing update for Visual Studio 2019 version 16.4.
I suspect part of the challenge in this case would have been estimating how many users would want to use Xamarin.AndroidX.Migration before the Visual Studio Studio 2019 version 16.5 release, and estimating how many of those users might already be using Visual Studio 2019 version 16.5 Preview for projects involving AndroidX. But I'm not sure if those were the main considerations.
Understood from the point of AndroidX. But as it is part of the 16.4 stable, which many of us are using as mentioned on this thread - naturally the fix pack cycle should get that fix. Right ?
It's an interesting one with the way timelines of the Visual Studio releases and the AndroidX NuGet package releases were somewhat independent from each other. (For example, Visual Studio 2019 version 16.4 was released at the beginning of December, while the AndroidX NuGet packages were promoted to non-preview status in mid-February. One consequence is that the Migrate to AndroidX command is only available starting in Visual Studio 2019 version 16.5 Preview.) I didn't hear much about the scheduling myself. Hopefully (a) the team will learn from this example for the future and (b) there won't be too many similar cases in the future because AndroidX was a fairly special new case.
@brendanzagaeski , I really appreciate your thoughts.
Not having HotRestart in GA and lack of fix for this issue has killed lot of time. So, is the frustration.
Looking forward to 16.5 GA soon.
Release status update
A new Release version has now been published on Windows that includes the fix for this item. The fix is not yet published in a Release version on macOS. I will update this item again when a Release version is available on macOS that includes the fix.
Fix included in Xamarin.Android 10.2.0.100.
Fix included on Windows in Visual Studio 2019 version 16.5. To get the new version that includes the fix, check for the latest updates or install the latest version from https://visualstudio.microsoft.com/downloads/.
(Fix also included on macOS in Visual Studio 2019 for Mac version 8.5 Preview 6 and higher. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel.)
_Release status update_
A new Release version has now been published on Windows that includes the fix for this item. The fix is not yet published in a Release version on macOS. I will update this item again when a Release version is available on macOS that includes the fix.
Fix included in Xamarin.Android 10.2.0.100.
Fix included on Windows in Visual Studio 2019 version 16.5. To get the new version that includes the fix, check for the latest updates or install the latest version from https://visualstudio.microsoft.com/downloads/.
(Fix also included on macOS in Visual Studio 2019 for Mac version 8.5 Preview 6 and higher. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel.)
Hi @brendanzagaeski and Xamarin Android team - I validated the fix in 16.5 GA. It is not more an issue. I would also like to thank you all for delivery a faster build and deployment experience for Xamarin Forms - Android apps. First time it felt as too good to be true. :)
From my end - this issue can be closed for now.
thank you.
Excellent. Thanks for testing it out, and happy to hear it!
Updating to version 16.5.0 worked for that bug, but when i run on my android device appear that now!
same problem with her Here

@CarlosHSantos, thanks for the info! That issue is being tracked by the Visual Studio team in an item on Developer Community:
https://developercommunity.visualstudio.com/content/problem/847661/error-preventing-debugging-xamarin-forms-after-dep.html
@CarlosHSantos, thanks for the info! That issue is being tracked by the Visual Studio team in an item on Developer Community:
https://developercommunity.visualstudio.com/content/problem/847661/error-preventing-debugging-xamarin-forms-after-dep.html
@brendanzagaeski
im really stuck, cant running on android device on version 16.5 because that error and cant downgrade to 16.4.5 because i work with community version and dont find that version on microsoft website..
@CarlosHSantos, it looks like that error is caused by a change in the debugger components that are shipped as part of the Visual Studio IDE, so the team working on the Developer Community item will have better technical insight on it.
One small bit of info I can add is that according to the doc on Visual Studio servicing, earlier versions of Visual Studio Community are not available.
Although earlier versions of Visual Studio Community are not available, there is a small chance that switching just the Mono.Debug*.dll assemblies to an earlier version might work. If you have an environment where you can experiment a little, you could try replacing the Mono.Debug*.dll assemblies in C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\Mono.Debugging with the files from Mono.Debugging.VisualStudio.16.5.24.vsix. The team working on the Development Community item would have better guidance on this possible approach, but from by general understanding, there is a chance it might succeed.
Sorry, but not worked. =/
Release status update
A new Release version has now been published on macOS that includes the fix for this item, as was published earlier on Windows.
Fix included in Xamarin.Android 10.2.0.100.
Fix included on macOS in Visual Studio 2019 for Mac version 8.5. To get the new version that includes the fix, check for the latest updates on the Stable updater channel.
(Fix also included on Windows in Visual Studio 2019 version 16.5 and higher. To get the new version that includes the fix, check for the latest updates or install the latest version from https://visualstudio.microsoft.com/downloads/.)
VS for Mac v8.5 solved the issue for me. Thanks!
Hello,
This issue still persists. I have installed the latest version of Visual Studio (stable as of 16/04/2020), clean install on both a Mac and a Windows computer. Both give the same error.
Any updates on this issue?
Hello,
This issue still persists. I have installed the latest version of Visual Studio (stable as of 16/04/2020), clean install on both a Mac and a Windows computer. Both give the same error.
Any updates on this issue?
VS for Mac here, the issue has been solved for me since said update has been released.
@vixez, if you continue to see an issue, the next best step would be to submit a new issue and attach your diagnostic MSBuild output so the team can take a look. Thanks in advance!
@brendanzagaeski Okay, I have created a new issue with the diagnostic logs (build and deployment) here.
Most helpful comment
This fix will be in 16.5 Preview 3.
To get a sense when it will go stable, there is not a public release date, but you can look at the pattern of past releases here: https://docs.microsoft.com/en-us/visualstudio/releases/2019/history