Tonny Loekito
Tonny Loekito

Reputation: 11

Drawer Layout Exist both in Xamarin.Android.Support.Core.UI and Xamarin.Android.Support.V4

I am a newbie in Xamarin with Visual Studio 2015. I have created project with Android Support V4 and V7 earlier, and it's work fine. But after I add components from Google Play Service MAP, then all my V4 objects get errors. For instance my drawer layout, this is the error :

Severity Code Description Project File Line Suppression State Error CS0433 The type 'DrawerLayout' exists in both 'Xamarin.Android.Support.Core.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' and 'Xamarin.Android.Support.v4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' gtSMobileAndroid D:\Source_eMedWeb\gotoSehat\gtSMobileAndroid\gtSMobileAndroid\MainActivity.cs 20 Active

I have done many things to recover, deleting all packages and reinstall the components, but still I get this error.

Please advice. Thank you very much in advance.

Upvotes: 1

Views: 2415

Answers (3)

Lukas Safari
Lukas Safari

Reputation: 1978

Here's how I solved this problem.

  • In Solution Explorer > Enable "Show All Files"
  • (Inside Visual Studio) Delete Obj Folder (Not the folder but files and folders in it)
  • Refresh Solution Explorer Tree
  • Again Delete Obj Folder (Not the folder but files and folders in it)
  • (Inside Visual Studio) Delete Bin Folder (Not the folder but files and folders in it)
  • Refresh Solution Explorer Tree
  • Again Delete Bin Folder (Not the folder but files and folders in it)
  • Refresh Solution Explorer Tree
  • Right Click On Project > Manage Nuget Packages > Updates > and then update all Android related dependencies
  • Rebuild Project (You will get some errors)
  • Right Click on Solution > Restore Nuget Packages
  • Rebuild Project

Have fun.

Upvotes: 1

Dr TJ
Dr TJ

Reputation: 3354

I had a similar error in on of my projects but about the Xamarin.Android.Support.V7 and Xamarin.Android.Support.V4.
The error appeared to me, in a Library project. I had a PCL Library and in the Droid part of that, I had added Xamarin.Android.Support.V7 but not the V4. And in the Target project (Consumer), I had both V4 and V7 added. So I believe the error was coming from a confusion in the consumer project or something like that. So, adding the V4 to the Library.Driod solved the problem for me.

I'm not sure if its helped to solve my problem or not, but I removed the V7 and added it back again to my Library.Driod project. (Can be necessary to do it)

XF v2.3.4.270

Upvotes: 0

SleepingDev
SleepingDev

Reputation: 91

I had the same issue. What fixed it for me was updating the Xamarin.Android.Support.v4 package from v23 to v24.2.1. Hope this helps.

Upvotes: 8

Related Questions