Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android ';缺少类型或命名空间名称';_Android_Xamarin - Fatal编程技术网

Android ';缺少类型或命名空间名称';

Android ';缺少类型或命名空间名称';,android,xamarin,Android,Xamarin,我正确地按照每个步骤在xamarin studio中开发了一个应用程序,如()所示 但是,在构建解决方案之后,出现了11个错误 1.“找不到类型或命名空间名称Android。(是否缺少using指令或程序集引用?) 2.“找不到类型或命名空间名称活动。(是否缺少using指令或程序集引用?) 3.“找不到类型或命名空间名称捆绑包。(是否缺少using指令或程序集引用?) 如何消除这些错误?请帮忙 这是密码--- 使用系统; 使用Android.App; 使用Android.Content; 使用

我正确地按照每个步骤在xamarin studio中开发了一个应用程序,如()所示 但是,在构建解决方案之后,出现了11个错误 1.“找不到类型或命名空间名称Android。(是否缺少using指令或程序集引用?) 2.“找不到类型或命名空间名称活动。(是否缺少using指令或程序集引用?) 3.“找不到类型或命名空间名称捆绑包。(是否缺少using指令或程序集引用?) 如何消除这些错误?请帮忙

这是密码---

使用系统;
使用Android.App;
使用Android.Content;
使用Android.Runtime;
使用Android.Views;
使用Android.Widget;
使用Android.OS;
名称空间音字
{
[活动(Label=“PhoneWord”,MainLauncher=true,Icon=“@drawable/Icon”)]
公共课活动:活动
{
整数计数=1;
创建时受保护的覆盖无效(捆绑包)
{
base.OnCreate(bundle);
//从“主”布局资源设置视图
SetContentView(Resource.Layout.Main);
//从加载的布局中获取我们的UI控件:
EditText phoneNumberText=FindViewById(Resource.Id.phoneNumberText);
按钮translateButton=FindViewById(Resource.Id.translateButton);
Button callButton=FindViewById(Resource.Id.callButton);
//禁用“呼叫”按钮
callButton.Enabled=false;
//添加代码来翻译数字
string translatedNumber=string.Empty;
translateButton.单击+=(对象发送者,事件参数e)=>
{
//将用户的字母数字电话号码转换为数字
translatedNumber=Core.PhonewordTranslator.tonNumber(phoneNumberText.Text);
if(String.IsNullOrWhiteSpace(translatedNumber))
{
callButton.Text=“Call”;
callButton.Enabled=false;
}
其他的
{
callButton.Text=“Call”+translatedNumber;
callButton.Enabled=true;
}
};
//从布局资源中获取我们的按钮,
//并在其上附加一个事件
/*Button Button=FindViewById(Resource.Id.myButton);
按钮。单击+=委派{
button.Text=string.Format(“{0}点击!”,count++);
};*/
}
}
}

谢谢

您的项目名称空间似乎包含类似于
MyProject.Android中的Android。这就是你所描述的原因


更改名称空间,它应该可以工作。

我通过添加对的引用解决了这个问题

Mono.Android.dll
位于:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v8.1\

你的项目参考资料中是否有Mono.Android的参考资料?您是否有名称空间冲突-如下面所建议的,如果您将项目命名为“Something.Android”,可能会导致与基本Android名称空间冲突。我已经用代码更新了我的问题。。。请看一看,谢谢我的项目名称空间是Phoneword,如果我将该名称空间更改为Android,另一组错误正在出现…你能把你的代码发布到哪里让我们看看吗?我已经用代码更新了我的问题。。。请看一看,谢谢你能在GitHub或Bitbucket上发布整个项目吗?看那一份文件,我看不出有什么不对劲。
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v8.1\