C# Shared Xamarin.Forms—类型或命名空间名称';App&x27;命名空间中不存在

C# Shared Xamarin.Forms—类型或命名空间名称';App&x27;命名空间中不存在,c#,android,xamarin,xamarin.forms,xamarin.android,C#,Android,Xamarin,Xamarin.forms,Xamarin.android,我正在学习Xamarin.表单教程。我根据说明构建了一个共享项目,但我在一个文件上遇到了一个错误,该文件是给我下载的,应该让我的应用程序在Android上访问拨号功能 这是我得到的全部错误: CS0234 The type or namespace name 'App' does not exist in the namespace 'Phoneword.Android' (are you missing an assembly reference?) Phoneword.Android

我正在学习Xamarin.表单教程。我根据说明构建了一个共享项目,但我在一个文件上遇到了一个错误,该文件是给我下载的,应该让我的应用程序在Android上访问拨号功能

这是我得到的全部错误:

CS0234  The type or namespace name 'App' does not exist in the namespace 'Phoneword.Android' (are you missing an assembly reference?)   Phoneword.Android
我在网上发现了一些类似的错误,包括,但没有一个解决方案适合我。总的趋势似乎是App类生活在共享项目中,因此一个不完整的引用可能会导致问题,但我删除了对共享项目的Android引用,出现了一系列其他错误,然后我重新添加了它,除了“App”一个错误,所有错误都消失了。所以我不认为这是一个参考问题

PhoneDialer.Droid.cs(我用错误标记了该行)

使用Android.Content;
使用System.Linq;
使用System.Threading.Tasks;
使用Android.Telephony;
使用Xamarin.Forms;
使用Phoneword.Android;
使用Uri=Android.Net.Uri;
[程序集:依赖项(typeof(PhoneDialer))]
名称空间Phoneword.Android
{
公共类电话拨号器:IDialer
{
公共任务拨号异步(字符串号)
{
var context=Android.App.Application.context;//厚脸皮的错误

将当前名称空间
名称空间Phoneword.Android
更改为
名称空间Phoneword.Droid
,一切都将正常工作

当您的命名空间名为
namespace Phoneword.Android
并尝试访问
Android.App.Application.Context
Android.
指的是您当前的项目…而不是Android本机库


若你们能将项目上传到Github,人们可能会给予很多帮助easy@ShiwankaChathuranga好主意,我添加了一个到Github的链接。因此,我还应该将“使用Phoneword.Android;”改为“使用Phoneword.Droid;”哇,我真不敢相信这就是问题所在。非常感谢!你能推荐将整个项目重命名为Phoneword.Droid吗?
using Android.Content;
using System.Linq;
using System.Threading.Tasks;
using Android.Telephony;
using Xamarin.Forms;
using Phoneword.Android;

using Uri = Android.Net.Uri;
[assembly: Dependency(typeof(PhoneDialer))]

namespace Phoneword.Android
{
    public class PhoneDialer : IDialer
    {
        public Task<bool> DialAsync(string number)
        {
            var context = Android.App.Application.Context; //<=ERROR
            ...
        }
        ...
    }
}