我正在尝试使用VSM15中的Xamarin运行PhoneWord教程Android应用。我已经用c#编写了所有代码并且构建良好。但是,当我在模拟器上运行它时,没有任何反应。我已经从现有的Nexus5和Nexus6定义创建了AVD,并添加了Galaxy S7的定义,全部使用API级别21(5.0 Lollipop)。我的应用程序针对API级别21(5.0 Lollipop),将其作为最低要求,并使用5.0(Lollipop)进行编译。
当我开始调试时,模拟器屏幕弹出其控件,但没有任何反应。有时我会在屏幕中央显示“Android”文本,但有时候它只是一个黑屏。我已经复制了下面某些日志文件的输出,但我对Android开发是全新的,所以不知道有哪些其他日志/调试信息可用,或者这是我的安装,我的应用程序,我的模拟器设置的问题,我的硬件或其他东西。
我尝试在VS中调试或首先调试并让它启动模拟器之前启动模拟器。我让它坐了一个小时或更长时间,没有任何变化。
我见过对VT-x和Intel HAXM的引用,但没有改变任何东西。我的模拟器都是ARM(armeabi / armeabi-v7a)。
的输出Xamarin IDE日志:
Xamarin.VisualStudio.UnhandledExceptionsManager Error: 0 : [2017-02-09 15:31:41.9755] An unhandled error occurred. Details: Error type 2 android.util.AndroidException: Can't connect to activity manager; is the system running? at com.android.commands.am.Am.onRun(Am.java:298) at com.android.internal.os.BaseCommand.run(BaseCommand.java:47) at com.android.commands.am.Am.main(Am.java:99) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:249) Mono.AndroidTools.AdbException: Error type 2 android.util.AndroidException: Can't connect to activity manager; is the system running? at com.android.commands.am.Am.onRun(Am.java:298) at com.android.internal.os.BaseCommand.run(BaseCommand.java:47) at com.android.commands.am.Am.main(Am.java:99) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:249) at Mono.AndroidTools.AndroidDevice.c__DisplayClass77_0.b__0(Task`1 t) at System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke() at System.Threading.Tasks.Task.Execute() Xamarin.VisualStudio.Devices.DeviceManager Error: 0 : [2017-02-09 15:34:22.9377] System.Runtime.InteropServices.COMException (0x80004005): Project unavailable. at EnvDTE.Project.get_FullName() at Clide.Solution.Adapters.MsBuildAdapter.Adapt(ProjectNode from) at lambda_method(Closure , IAdapter , Object ) at Clide.Patterns.Adapter.AdapterService.Adapt[TSource,TTarget](TSource source) at Clide.Patterns.Adapter.AdapterService.Adaptable`1.As[T]() at Clide.Sdk.Solution.ProjectNode.As[T]() at Clide.Solution.Implementation.UserProjectProperties..ctor(ProjectNode project) at Clide.Sdk.Solution.ProjectNode.get_UserProperties() at Xamarin.VisualStudio.Devices.DeviceManager.GetBestDeviceFor(IProjectNode projectNode, IEnumerable`1 availableDevices) in C:\data\lanes\3513\00fa5cc4\source\xamarinvs\src\Core\VisualStudio.Devices\DeviceManager.cs:line 128Xamarin monodroid日志:
MonoDroidLog Information: 0 : [2017-02-09 15:35:06.3451] [I:sdk]: Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidSdkDirectory found: Path contains adb in \platform-tools (C:\Program Files (x86)\Android\android-sdk). MonoDroidLog Information: 0 : [2017-02-09 15:35:06.3521] [I:sdk]: Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidNdkDirectory found: Path contains ndk-stack in \. (C:\ProgramData\Microsoft\AndroidNDK\android-ndk-r11c\). MonoDroidLog Information: 0 : [2017-02-09 15:35:06.3601] [I:sdk]: Key HKCU\SOFTWARE\Novell\Mono for Android\JavaSdkDirectory not found. MonoDroidLog Information: 0 : [2017-02-09 15:35:06.3751] [I:sdk]: Key HKCU\SOFTWARE\Novell\Mono for Android\JavaSdkDirectory not found. MonoDroidLog Information: 0 : [2017-02-09 15:35:06.3942] [I:sdk]: Key HKLM\SOFTWARE\Novell\Mono for Android\JavaSdkDirectory not found. MonoDroidLog Information: 0 : [2017-02-09 15:35:06.4042] [I:sdk]: Looking for Java 6 SDK.. MonoDroidLog Information: 0 : [2017-02-09 15:35:06.4112] [I:sdk]: Key HKLM\SOFTWARE\JavaSoft\Java Development Kit\CurrentVersion found. MonoDroidLog Information: 0 : [2017-02-09 15:35:06.4192] [I:sdk]: Key HKLM\SOFTWARE\JavaSoft\Java Development Kit\1.6\JavaHome not found. MonoDroidLog Information: 0 : [2017-02-09 15:35:06.4322] [I:sdk]: Key HKLM\SOFTWARE\JavaSoft\Java Development Kit\1.7\JavaHome found: Path contains jarsigner.exe in \bin (C:\Program Files (x86)\Java\jdk1.7.0_55). MonoDroidLog Information: 0 : [2017-02-09 15:35:06.4662] [I:Unknown]: Found Xamarin.Android 7.0.2 MonoDroidLog Information: 0 : [2017-02-09 15:35:06.4772] [I:Unknown]: Found Android SDK. API levels: 21, 22, 23 MonoDroidLog Information: 0 : [2017-02-09 15:35:14.6236] [I:]: Tracking android devices started MonoDroidLog Information: 0 : [2017-02-09 15:35:14.6446] [D:]: Tracking avd started MonoDroidLog Information: 0 : [2017-02-09 15:35:14.6626] [D:]: avd watcher *.ini path: 'C:\Users\Mark\.android\avd' MonoDroidLog Information: 0 : [2017-02-09 15:35:14.6746] [D:]: TrackDeviceTask got: MonoDroidLog Information: 0 : [2017-02-09 15:35:14.6846] [I:]: Got new device list from adb with 0 devices MonoDroidLog Information: 0 : [2017-02-09 15:35:14.6956] [D:]: avd watcher android path: 'C:\PROGRA~2\Android\ANDROI~1\tools\android.BAT' MonoDroidLog Information: 0 : [2017-02-09 15:35:16.8547] [D:]: avd watcher: got device list from avd with 2 devices MonoDroidLog Information: 0 : [2017-02-09 15:36:08.1347] [D:]: TrackDeviceTask got: emulator-5554 offline MonoDroidLog Information: 0 : [2017-02-09 15:36:08.1457] [I:]: Got new device list from adb with 1 devices MonoDroidLog Information: 0 : [2017-02-09 15:36:27.8368] [D:]: TrackDeviceTask got: emulator-5554 device MonoDroidLog Information: 0 : [2017-02-09 15:36:27.8458] [I:]: Got new device list from adb with 1 devices MonoDroidLog Information: 0 : [2017-02-09 15:36:27.8598] [D:RunShellCommand]: emulator-5554 getprop MonoDroidLog Information: 0 : [2017-02-09 15:36:27.8748] [D:RunShellCommand]: emulator-5554 getprop MonoDroidLog Information: 0 : [2017-02-09 15:36:49.6961] [I:Unknown]: Found Android SDK. API levels: 21, 22, 23 MonoDroidLog Information: 0 : [2017-02-09 15:36:49.7461] [D:RunShellCommand]: emulator-5554 getprop MonoDroidLog Information: 0 : [2017-02-09 15:36:50.7321] [D:RunShellCommand]: emulator-5554 am broadcast -a "mono.android.intent.action.PACKAGE_VERSIONS" -e "packages" "Mono.Android.DebugRuntime,Mono.Android.Platform.ApiLevel_21,HelloAndroid2.HelloAndroid2" -n "Mono.Android.DebugRuntime/com.xamarin.mono.android.PackageVersions" MonoDroidLog Information: 0 : [2017-02-09 15:36:58.2065] [D:RunShellCommand]: emulator-5554 cat /data/system/packages.xml MonoDroidLog Information: 0 : [2017-02-09 15:37:18.2327] [D:RunShellCommand]: emulator-5554 pm install "/data/local/tmp/HelloAndroid2.HelloAndroid2-Signed.apk" MonoDroidLog Information: 0 : [2017-02-09 15:37:23.6120] [D:RunShellCommand]: emulator-5554 rm "/data/local/tmp/HelloAndroid2.HelloAndroid2-Signed.apk" MonoDroidLog Error: 0 : [2017-02-09 15:37:24.1470] [E:]: Deployment failed Mono.AndroidTools.InstallFailedException: Unexpected install output: Error: Could not access the Package Manager. Is the system running? at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName) at Mono.AndroidTools.AndroidDevice.c__DisplayClass91_0.b__0(Task`1 t) at System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke() at System.Threading.Tasks.Task.Execute() MonoDroidLog Information: 0 : [2017-02-09 15:37:24.8721] [D:RunShellCommand]: emulator-5554 date +%s MonoDroidLog Information: 0 : [2017-02-09 15:37:25.2461] [D:RunShellCommand]: emulator-5554 setprop "debug.mono.extra" "debug=127.0.0.1:8947:8948,timeout=1486676275,loglevel=0,server=y" MonoDroidLog Information: 0 : [2017-02-09 15:37:25.5571] [D:RunShellCommand]: emulator-5554 getprop MonoDroidLog Information: 0 : [2017-02-09 15:37:25.8891] [D:RunShellCommand]: emulator-5554 "echo" "-n" "${EMULATED_STORAGE_SOURCE}" MonoDroidLog Information: 0 : [2017-02-09 15:37:26.0201] [D:RunShellCommand]: emulator-5554 "echo" "-n" "${EMULATED_STORAGE_TARGET}" MonoDroidLog Information: 0 : [2017-02-09 15:37:26.1601] [D:RunShellCommand]: emulator-5554 am broadcast -a "mono.android.intent.action.EXTERNAL_STORAGE_DIRECTORY" -n "Mono.Android.DebugRuntime/com.xamarin.mono.android.ExternalStorageDirectory" MonoDroidLog Information: 0 : [2017-02-09 15:37:31.4024] [D:RunShellCommand]: emulator-5554 "echo" "-n" "${EXTERNAL_STORAGE}" MonoDroidLog Information: 0 : [2017-02-09 15:37:31.5895] [D:RunShellCommand]: emulator-5554 am start -a "android.intent.action.MAIN" -c "android.intent.category.LAUNCHER" -n "HelloAndroid2.HelloAndroid2/md5c35c20f10c18d97cfa5803a7c4a6812a.MainActivity" MonoDroidLog Information: 0 : [2017-02-09 15:37:41.6850] [D:RunShellCommand]: emulator-5554 ps MonoDroidLog Information: 0 : [2017-02-09 15:37:42.2211] [D:RunShellCommand]: emulator-5554 am force-stop HelloAndroid2.HelloAndroid2 MonoDroidLog Information: 0 : [2017-02-09 15:37:42.2461] [D:RunShellCommand]: emulator-5554 setprop "debug.mono.connect" "" MonoDroidLog Information: 0 : [2017-02-09 15:38:43.8396] [D:]: TrackDeviceTask got: MonoDroidLog Information: 0 : [2017-02-09 15:38:43.8556] [I:]: Got new device list from adb with 0 devices MonoDroidLog Information: 0 : [2017-02-09 15:39:05.9028] [D:]: TrackDeviceTask got: emulator-5554 offline MonoDroidLog Information: 0 : [2017-02-09 15:39:05.9149] [I:]: Got new device list from adb with 1 devices MonoDroidLog Information: 0 : [2017-02-09 15:39:24.8799] [D:]: TrackDeviceTask got: emulator-5554 device MonoDroidLog Information: 0 : [2017-02-09 15:39:24.8919] [I:]: Got new device list from adb with 1 devices MonoDroidLog Information: 0 : [2017-02-09 15:39:24.9049] [D:RunShellCommand]: emulator-5554 getprop MonoDroidLog Information: 0 : [2017-02-09 15:39:24.9209] [D:RunShellCommand]: emulator-5554 getprop MonoDroidLog Information: 0 : [2017-02-09 15:39:44.6171] [I:Unknown]: Found Android SDK. API levels: 21, 22, 23 MonoDroidLog Information: 0 : [2017-02-09 15:39:44.6371] [D:RunShellCommand]: emulator-5554 getprop MonoDroidLog Information: 0 : [2017-02-09 15:39:45.2531] [D:RunShellCommand]: emulator-5554 am broadcast -a "mono.android.intent.action.PACKAGE_VERSIONS" -e "packages" "Mono.Android.DebugRuntime,Mono.Android.Platform.ApiLevel_21,HelloAndroid2.HelloAndroid2" -n "Mono.Android.DebugRuntime/com.xamarin.mono.android.PackageVersions" MonoDroidLog Information: 0 : [2017-02-09 15:39:53.1496] [D:RunShellCommand]: emulator-5554 cat /data/system/packages.xml MonoDroidLog Information: 0 : [2017-02-09 15:40:10.3725] [D:RunShellCommand]: emulator-5554 pm install "/data/local/tmp/HelloAndroid2.HelloAndroid2-Signed.apk" MonoDroidLog Information: 0 : [2017-02-09 15:40:15.9999] [D:RunShellCommand]: emulator-5554 rm "/data/local/tmp/HelloAndroid2.HelloAndroid2-Signed.apk" MonoDroidLog Error: 0 : [2017-02-09 15:40:16.4479] [E:]: Deployment failed Mono.AndroidTools.InstallFailedException: Unexpected install output: Error: Could not access the Package Manager. Is the system running? at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName) at Mono.AndroidTools.AndroidDevice.c__DisplayClass91_0.b__0(Task`1 t) at System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke() at System.Threading.Tasks.Task.Execute() MonoDroidLog Information: 0 : [2017-02-09 15:40:16.7279] [D:RunShellCommand]: emulator-5554 date +%s MonoDroidLog Information: 0 : [2017-02-09 15:40:17.1079] [D:RunShellCommand]: emulator-5554 setprop "debug.mono.extra" "debug=127.0.0.1:8949:8950,timeout=1486676447,loglevel=0,server=y" MonoDroidLog Information: 0 : [2017-02-09 15:40:17.4169] [D:RunShellCommand]: emulator-5554 getprop MonoDroidLog Information: 0 : [2017-02-09 15:40:17.8090] [D:RunShellCommand]: emulator-5554 "echo" "-n" "${EMULATED_STORAGE_SOURCE}" MonoDroidLog Information: 0 : [2017-02-09 15:40:18.0240] [D:RunShellCommand]: emulator-5554 "echo" "-n" "${EMULATED_STORAGE_TARGET}" MonoDroidLog Information: 0 : [2017-02-09 15:40:18.1630] [D:RunShellCommand]: emulator-5554 am broadcast -a "mono.android.intent.action.EXTERNAL_STORAGE_DIRECTORY" -n "Mono.Android.DebugRuntime/com.xamarin.mono.android.ExternalStorageDirectory" MonoDroidLog Information: 0 : [2017-02-09 15:40:23.6083] [D:RunShellCommand]: emulator-5554 "echo" "-n" "${EXTERNAL_STORAGE}" MonoDroidLog Information: 0 : [2017-02-09 15:40:23.8193] [D:RunShellCommand]: emulator-5554 am start -a "android.intent.action.MAIN" -c "android.intent.category.LAUNCHER" -n "HelloAndroid2.HelloAndroid2/md5c35c20f10c18d97cfa5803a7c4a6812a.MainActivity" MonoDroidLog Information: 0 : [2017-02-09 15:40:33.7989] [D:RunShellCommand]: emulator-5554 ps MonoDroidLog Information: 0 : [2017-02-09 15:40:34.3339] [D:RunShellCommand]: emulator-5554 am force-stop HelloAndroid2.HelloAndroid2 MonoDroidLog Information: 0 : [2017-02-09 15:40:34.3509] [D:RunShellCommand]: emulator-5554 setprop "debug.mono.connect" "" MonoDroidLog Information: 0 : [2017-02-09 15:42:05.8061] [D:]: TrackDeviceTask got: MonoDroidLog Information: 0 : [2017-02-09 15:42:05.8201] [I:]: Got new device list from adb with 0 devices
答案 0 :(得分:0)
我能够让它工作,虽然我不确定它只是我做的步骤中的一个或它们的组合。
我在项目中有两个布局(Main.axml和ListLayout.axml),可能来自另一个教程,但只填写了其中一个。我的MainActivity
正在调用空布局。我改变了它来调用正确的布局。
我的项目设置也没有任何支持的架构(Project-> Properties-> Android Options-> Advanced),因此我选中了armeabi
和armeabi-v7a
。我还检查了选项(在“打包”选项卡上),为每个体系结构生成一个包,并取消选中使用共享运行时和快速部署的选项。
完成所有这些后,我能够让模拟器运行并测试Phoneword
应用。
然后我在我的BIOS中启用了虚拟化,在x86
架构上检查,定义了一个带有Intel x86 CPU的新仿真器设备,现在能够更快地运行仿真器。