我厌倦了xamarin原生的android和表单,但两者似乎都有效。两者都有错误。
尝试创建空白的xamarin android应用程序,没有任何代码写入其中,厌倦了xamarin表单应用程序。是否构建,重建,清理,重新启动系统,重新启动可视化工作室,以管理员身份运行vs所有可能的事情,但没有任何成效。
以下是设备日志信息
Time Device Name Type PID Tag Message
10-13 23:18:30.003 Motorola XT1068 Error 19565 AndroidRuntime java.lang.RuntimeException: Unable to get provider mono.MonoRuntimeProvider: java.lang.RuntimeException: Unable to find application Mono.Android.DebugRuntime!
at android.app.ActivityThread.installProvider(ActivityThread.java:5177)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4769)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4709)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Time Device Name Type PID Tag Message
10-13 23:18:30.003 Motorola XT1068 Error 19565 AndroidRuntime Caused by: android.content.pm.PackageManager$NameNotFoundException: Mono.Android.DebugRuntime
at android.app.ApplicationPackageManager.getApplicationInfo(ApplicationPackageManager.java:304)
at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:41)
... 11 more
Time Device Name Type PID Tag Message
10-13 23:18:30.003 Motorola XT1068 Error 19565 AndroidRuntime Caused by: java.lang.RuntimeException: Unable to find application Mono.Android.DebugRuntime!
at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:47)
at android.app.ActivityThread.installProvider(ActivityThread.java:5174)
... 10 more
以下是输出信息
2>An existing connection was forcibly closed by the remote host
2>Done building project "demoapp.csproj".
2>Build succeeded.
2>An existing connection was forcibly closed by the remote host
2>
2>Deploy failed on Motorola XT1068
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
系统信息:
Windows 10操作系统
Microsoft Visual Studio Enterprise 2017 版本15.4.0
VisualStudio.15.Release / 15.4.0 + 27004.2002 Microsoft .NET Framework 版本4.7.02046
Xamarin 4.7.10.22 Visual Studio扩展,支持Xamarin.iOS和Xamarin.Android的开发。
Xamarin.Android SDK 8.0.0.33 Xamarin.Android参考装配和MSBuild支持。
Xamarin.iOS和Xamarin.Mac SDK 11.2.0.8 Xamarin.iOS和Xamarin.Mac参考组件和MSBuild支持。
更改为x86和发布模式后,现在可以在模拟器中运行。下面是图片。
但仍然无法在Android设备上运行
被修改
Android csproj文件内容
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SelectedDevice>Motorola XT1068</SelectedDevice>
<DefaultDevice>5" KitKat %284.4%29 XXHDPI Phone</DefaultDevice>
<AndroidDesignerPreferredDevice>Nexus 4</AndroidDesignerPreferredDevice>
</PropertyGroup>
</Project>
Android项目属性