2017-02-09 1 views
2

nicht starten Ich versuche, die Android-App PhoneWord mit Xamarin in VS2015 auszuführen. Ich habe alles in C# programmiert und es baut gut. Wenn ich es jedoch auf einem Emulator starte, passiert nichts. Ich habe AVDs aus den bestehenden Nexus5- und Nexus6-Definitionen erstellt und eine Definition für ein Galaxy S7 hinzugefügt, die alle API Level 21 (5.0 Lollipop) verwenden. Meine App zielt auf API Level 21 (5.0 Lollipop), hat es als Mindestanforderung und wird mit 5.0 (Lollipop) kompiliert.Kann Android-Emulator in Visual Studio 2015 mit Xamarin

Wenn ich mit dem Debuggen beginne, erscheint der Emulatorbildschirm mit seinen Steuerelementen, aber nichts passiert. Manchmal bekomme ich "Android" -Text, der in der Mitte des Bildschirms angezeigt wird, aber manchmal ist es nur ein schwarzer Bildschirm. Ich habe die Ausgabe einiger Log-Dateien unten kopiert, bin aber völlig neu in der Android-Entwicklung, weiß also nicht, welche anderen Log/Debug-Informationen verfügbar sind, oder wenn das ein Problem mit meiner Installation, meiner App, meinen Emulator-Einstellungen ist, meine Hardware oder etwas anderes.

Ich habe versucht, den Emulator vor dem Debuggen in VS oder dem Debuggen zuerst zu starten und den Emulator starten zu lassen. Ich habe es für eine Stunde oder länger sitzen lassen, ohne Veränderung.

Ich habe Referenzen zu VT-x und Intel HAXM gesehen, aber habe dort nichts geändert. Meine Emulatoren sind alle ARM (armeabi/armeabi-v7a).

Ausgabe von logcat

Xamarin IDE Protokoll:

 
    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 128 

Xamarin monodroid log:

 
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 

Antwort

0

konnte ich es zum Laufen zu bringen, obwohl ich nicht sicher bin, ob es nur 1 der Schritte, die ich getan habe oder eine Kombination von ihnen.

Ich hatte zwei Layouts (Main.axml und ListLayout.axml) im Projekt, wahrscheinlich von einem anderen Tutorial, aber nur 1 von ihnen wurde ausgefüllt. Mein MainActivity hat das leere Layout aufgerufen. Ich änderte es, um das korrekte Layout zu nennen.

Meine Projekteinstellungen hatten auch keine unterstützten Architekturen (Projekt-> Eigenschaften-> Android Optionen-> Erweitert), also habe ich auf armeabi und armeabi-v7a gecheckt. Ich überprüfte auch die Option (auf der Registerkarte "Verpackung"), um ein Paket pro Architektur zu generieren, und deaktivierte die Optionen für die gemeinsame Laufzeit und schnelle Bereitstellung.

All dies konnte ich den Emulator zu starten und testen Sie die Phoneword App.

Ich habe dann die Virtualisierung in meinem BIOS aktiviert, auf der x86 Architektur überprüft, ein neues Emulatorgerät mit der Intel x86 CPU definiert und bin in der Lage, den Emulator nun viel schneller zu starten.

Verwandte Themen