I am developing an application using Xamarin and got stuck into this error. The error has been generated from my .Droid project while building the solution (Clean Solution is successful). The 'Interface' is a folder which is present inside my Portable PCL project. Basically I want to implement an interface (declared inside my Portable project) into my .Droid project. I have already tried to refer that Interface folder with using keyword but it says does not exist. And since the folder is not getting referenced, all the interfaces inside that folder are also not getting referenced.
The below code is of .Droid project file in which interface has to be implemented.
using ProjectName;
using ProjectName.Interface;
using Xamarin.Forms;
[assembly: Dependency(typeof(FileName))]
namespace ProjectName.Droid
{
class FileName : InterfaceName
{
....
}
}
The below code is of one of the Portable project interface file inside Interface folder.
using System;
using ProjectName;
namespace ProjectName.Interface
{
public interface InterfaceName
{
....
}
}
When I try to Add Reference of Portable project into .Droid project it says:
Unable to add reference to Portable project. The current project's target is not one of or compatible with the targets of Portable Project.
Please Note:
- I am using Visual Studio 2019.
- My Portable project Target Frameworks are: .NET Framework 4.5, ASP.NET Core 1.0, Windows 8, Windows 8.1, Windows Phone Silverlight 8.
- My Droid project Target is Android 11.0(API Level 30 -R)
- I have already added Mono.Android.dll file inside Portable as well as Droid project.
- I have tried deleting bin and obj folder of both projects but didn't worked at all.
- I am unable to add Reference of my Portable project into my Droid project.
- Also, all the interfaces inside 'Interface' folder are public.
Any kind of help will be appreciated.