Home > Software design >  Can not resolve reference: `Windows.Foundation.UniversalApiContract in Android App
Can not resolve reference: `Windows.Foundation.UniversalApiContract in Android App

Time:02-03

I developed a Xamarin Cross Platform application that is working perfectly on Windows but when I try to recompile for Android I get the following error:

Can not resolve reference: `Windows.Foundation.UniversalApiContract

I use the Windows.Foundation.UniversalApiContract reference because of the Windows.Storage class (generate files in internal memory). I understand that I may have to change the recording method on Android but I can't even get to that stage... How do I resolve this situation?

CodePudding user response:

Just as ToolmakerSteve said, Windows namespace relies on features that exist only in Windows. The reference should not be in the main .Net Standard library but in the UWP Application.

First, you can move the code to the Windows folder or set the #if Windows around it.

Second, you can write the code for each platform. I found the answer you can refer to Can not resolve reference: Windows.Foundation.UniversalApiContract in Android Application.

  • Related