4

I have a Mobile App built with Xamarin.Forms

After I Updated Visual Studio from 16.4.4 to 16.7.0

These errors appeared

Assembly 'Xamarin.GooglePlayServices.Maps' is using '[assembly: Java.Interop.JavaLibraryReferenceAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author. MyApp.Android           
Assembly 'Xamarin.Android.Support.v7.CardView' is using '[assembly: Android.IncludeAndroidResourcesFromAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.   MyApp.Android           
Assembly 'Xamarin.GooglePlayServices.Base' is using '[assembly: Android.IncludeAndroidResourcesFromAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.   MyApp.Android           
Assembly 'Xamarin.Android.Support.v7.MediaRouter' is using '[assembly: Java.Interop.JavaLibraryReferenceAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.  MyApp.Android           
Assembly 'Xamarin.Android.Support.Vector.Drawable' is using '[assembly: Java.Interop.JavaLibraryReferenceAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author. MyApp.Android           
Assembly 'Xamarin.Android.Support.Design' is using '[assembly: Android.IncludeAndroidResourcesFromAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.    MyApp.Android           
Assembly 'Xamarin.GooglePlayServices.Gcm' is using '[assembly: Java.Interop.JavaLibraryReferenceAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.  MyApp.Android           
Assembly 'Xamarin.Android.Support.v7.AppCompat' is using '[assembly: Java.Interop.JavaLibraryReferenceAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.    MyApp.Android           
Assembly 'Xamarin.Android.Support.v7.RecyclerView' is using '[assembly: Java.Interop.JavaLibraryReferenceAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author. MyApp.Android           
Assembly 'Xamarin.GooglePlayServices.Basement' is using '[assembly: Android.IncludeAndroidResourcesFromAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.   MyApp.Android           
Assembly 'Xamarin.Android.Support.Animated.Vector.Drawable' is using '[assembly: Java.Interop.JavaLibraryReferenceAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.    MyApp.Android           
Assembly 'Xamarin.Android.Support.v7.AppCompat' is using '[assembly: Android.IncludeAndroidResourcesFromAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.  MyApp.Android           
Assembly 'Xamarin.GooglePlayServices.Maps' is using '[assembly: Android.IncludeAndroidResourcesFromAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.   MyApp.Android           
Assembly 'Xamarin.Android.Support.v4' is using '[assembly: Java.Interop.JavaLibraryReferenceAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.  MyApp.Android           
Assembly 'Xamarin.Android.Support.v7.CardView' is using '[assembly: Java.Interop.JavaLibraryReferenceAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author. MyApp.Android           
Assembly 'Xamarin.Android.Support.v4' is using '[assembly: Java.Interop.JavaLibraryReferenceAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.  MyApp.Android           
Assembly 'Xamarin.GooglePlayServices.Gcm' is using '[assembly: Android.IncludeAndroidResourcesFromAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.    MyApp.Android           
Assembly 'Xamarin.Android.Support.v7.RecyclerView' is using '[assembly: Android.IncludeAndroidResourcesFromAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.   MyApp.Android           
Assembly 'Xamarin.Android.Support.Design' is using '[assembly: Java.Interop.JavaLibraryReferenceAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.  MyApp.Android           
Assembly 'Xamarin.Android.Support.v7.MediaRouter' is using '[assembly: Java.Interop.JavaLibraryReferenceAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.  MyApp.Android           
Assembly 'Xamarin.Android.Support.Animated.Vector.Drawable' is using '[assembly: Android.IncludeAndroidResourcesFromAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.  MyApp.Android           
Assembly 'Xamarin.Android.Support.Vector.Drawable' is using '[assembly: Android.IncludeAndroidResourcesFromAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.   MyApp.Android           
Assembly 'Xamarin.GooglePlayServices.Base' is using '[assembly: Java.Interop.JavaLibraryReferenceAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author. MyApp.Android           
Assembly 'Xamarin.Android.Support.v7.MediaRouter' is using '[assembly: Android.IncludeAndroidResourcesFromAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.    MyApp.Android           
Assembly 'Xamarin.Android.Support.v4' is using '[assembly: Android.IncludeAndroidResourcesFromAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.    MyApp.Android           
Assembly 'Xamarin.GooglePlayServices.Basement' is using '[assembly: Java.Interop.JavaLibraryReferenceAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author. MyApp.Android       

What I have tried?

1- I tried to delete bin and obj folders to force the project to rebuild everything, but the errors still appear

2- I tried to downgrade to 16.4.4 and the errors are gone, but I don't want to fix it by this way because I want to create a new other application using this new feature in 16.7.0

So, Is there a way to get rid of these errors without downgrade to the old version?

Notes:

The version of Xamarin.Forms is 2.3

Anas Alweish
  • 2,818
  • 4
  • 30
  • 44
  • Please set the `TargetFramework` to the latest to make a test like this setting screenshot https://imgur.com/a/6qklMqN – Leon Aug 11 '20 at 05:36
  • @LeonLu-MSFT thanks for your comment, I tried this now but unfortunately, the errors still appear – Anas Alweish Aug 11 '20 at 07:08
  • @LeonLu-MSFT the version of xamarin.forms I use is 2.3 – Anas Alweish Aug 11 '20 at 07:16
  • Please update your xamarin forms version to the latest. – Leon Aug 11 '20 at 07:17
  • 1
    xamarin forms 2.3 is too old. If you use other nuget packages, plesae update all of them – Leon Aug 11 '20 at 07:17
  • unfortunately, I can't update to the latest version because I use old libraries based on version 2.3. So, if I update XF to 4.8 I will not be able to use these libraries and i should change it – Anas Alweish Aug 11 '20 at 07:31
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/219596/discussion-between-anas-alweish-and-leon-lu-msft). – Anas Alweish Aug 11 '20 at 08:50
  • Could you please provide a sample? – Singhal2 Aug 14 '20 at 07:56
  • @Singhal2 apologize, this app is for my company and I cannot share it here – Anas Alweish Aug 14 '20 at 08:34
  • I open the error's link.I found this thread https://learn.microsoft.com/en-us/dotnet/core/project-sdk/overview#default-compilation-includes – Leon Aug 18 '20 at 09:49
  • Whats the exact version of 2.3? i had the same issue i have fixed it – Blu Aug 18 '20 at 13:25
  • @Blu Xamarin.Forms v2.3 – Anas Alweish Aug 18 '20 at 16:15
  • @LeonLu-MSFT Thanks for the mention I will try this and tell you the result – Anas Alweish Aug 18 '20 at 16:19
  • @AnasAlweish try upgrading XF version to v2.5.0.28055, as it won't break any of your custom controls or renderers if you go ahead than this, few internal API calls get restricted & won't work. v2.5.0.28055 this is the version working for me. (*my error was - the project couldn't build, it always fails then after few changes it worked but I got error of target invocation & application use to get crash ) – Blu Aug 18 '20 at 16:24
  • Same as you, I cant further upgrade my XF version as it breaks some of our custom controls. I literally wasted 3-4 weeks to find it out & run my project successfully without breaking anything. – Blu Aug 18 '20 at 16:25
  • Thanks for your comment again (this error)[https://learn.microsoft.com/en-us/dotnet/core/project-sdk/overview#build-errors] appeared after I upgraded to `v2.5.0.28055` and after I tried the solution provided in the above document I get other errors such as `CustomRenderer not found ... are you missing ...` and also fixed and then when I rebuild the project I get other errors ... – Anas Alweish Aug 19 '20 at 13:02
  • So, because I have another PC, I think it's better for me to save the time and run this project on the old version to support the app until the company decide to upgrade to the latest version of Xamarin.Forms – Anas Alweish Aug 19 '20 at 13:02
  • For others, if you faced the same issue and you don't have in your project other libraries based on the old version of XF, it's better for you to upgrade to the latest version as @Brandon Minnick recommended [here](https://stackoverflow.com/a/63417174/4977870) – Anas Alweish Aug 19 '20 at 13:04

2 Answers2

5

The version of Xamarin.Forms is 2.3

You'll need to update a newer version of Xamarin.Forms because Visual Studio 2019 won't support v2.3; Xamarin.Forms v2.3 was released in 2016.

I recommend using the latest version of Xamarin.Forms.

Brandon Minnick
  • 13,342
  • 15
  • 65
  • 123
  • 1
    Thank you very much for your answer, **I know your answer is the correct**, but when I upgraded the project [from vs2017 to vs2019](https://stackoverflow.com/q/56196973/4977870) these errors have not appeared, and now If I downgrade to the old version `16.4.4` I can build the project. **So, do you mean `XF v2.3` won't be supported from version `VS 16.7` and higher?** – Anas Alweish Aug 15 '20 at 10:23
  • 1
    Also, I can't update to the latest version because I use old libraries based on version 2.3, and for that reason, I try to find another solution because the app is installed on customer devices also my company don't' want to upgrade now – Anas Alweish Aug 15 '20 at 10:26
  • Thank you, Brandon, for the correct answer but for me, I can't update now, So, I opened the project on another device using vs2019 16.4.4 and it's working fine – Anas Alweish Aug 19 '20 at 13:13
3

android version 10 don't support Xamarin.Android.Support.v7 if you change your target framework version to Android version 9 your able to debug in device.

follow the step

go to Android.project > properties > target framework

enter image description here

enter image description here