我刚刚编写了一个示例Xamarin Android应用程序,所有内容都正确构建:
1>------ Rebuild All started: Project: App7, Configuration: Debug Any CPU ------
1> Processing: obj\Debug\res\layout\main.xml
1> Processing: obj\Debug\res\values\strings.xml
1>C:\Users\mepapasymeon\Documents\Visual Studio 2013\Projects\App7\App7\MainActivity.cs(14,13,14,18): warning CS0414: The field 'Phoneword.MainActivity.count' is assigned but its value is never used
1> App7 -> C:\Users\mepapasymeon\Documents\Visual Studio 2013\Projects\App7\App7\bin\Debug\App7.dll
1> Processing: obj\Debug\res\layout\main.xml
1> Processing: obj\Debug\res\values\strings.xml
1> Processing: obj\Debug\res\layout\main.xml
1> Processing: obj\Debug\res\values\strings.xml
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
Build started.
Build succeeded.
Build started.
Build succeeded.
但是当我按下开始时
1>Please select a valid device before running the application.
1>------ Deploy started: Project: App7, Configuration: Debug Any CPU ------
1>Error: Cancelled
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
这是Xamarin Diagnostics:
[I:sdk]: Looking for Android SDK..
[I:sdk]: Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidSdkDirectory found:
Path contains adb.exe in \platform-tools (C:\Users\Administrator\AppData\Local\Android\android-sdk).
[I:sdk]: Key HKLM\SOFTWARE\Novell\Mono for Android\AndroidSdkDirectory found:
Path does not contain adb.exe in \platform-tools (C:\android-sdk-windows).
[I:sdk]: Key HKCU\SOFTWARE\Xamarin\MonoAndroid\PrivateAndroidSdkPath not found.
[I:sdk]: Key HKCU\SOFTWARE\Android SDK Tools\Path not found.
[I:sdk]: Key HKLM\SOFTWARE\Android SDK Tools\Path found:
Path contains adb.exe in \platform-tools (C:\Users\Administrator\AppData\Local\Android\android-sdk).
[I:sdk]: Looking for Android NDK..
[I:sdk]: Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidNdkDirectory found:
Path contains ndk-stack.exe in \. (C:\Users\mepapasymeon\Documents\Android\ndk\android-ndk-r10e).
[I:sdk]: Key HKLM\SOFTWARE\Novell\Mono for Android\AndroidNdkDirectory not found.
[I:Unknown]: Found Android SDK. API levels: 15, 19, 23
[I:Unknown]: Found Xamarin.Android 6.0.3
答案 0 :(得分:0)
1>请在运行应用程序之前选择有效的设备。
您必须安装并配置模拟器,然后选择与您所在的API级别(或更高级别)匹配的已配置模拟手机正在构建您的.apk
以便"部署"它。或者使用已经开发人员模式的物理设备,并启用 USB调试并连接到Windows PC。
一旦Xamarin Android Player运行,启动Visual Studio并从工具栏启动Android ADB命令提示符:
在显示的命令提示符下,输入adb connect:
答案 1 :(得分:0)
此问题已经回答here
你必须下载android虚拟设备。
这里有几个选项:
现在您拥有了虚拟设备。你需要在运行或调试之前启动一个。
您看到的具体错误是因为您在调试之前没有正确启动设备,您应该能够看到该设备。
现在运行该项目,您将不会遇到此错误。