• 第一个VS2015 Xaramin Android项目(终)


    其实还有一个问题没解决,也拖很久了。中途公司的项目太紧导致无法学习更新。

    之前的问题是这样的:项目搭建成功了,App也成功发布到虚拟机。便尝试增加控件

    Xaml 设计界面如下:

    但是在虚拟机运行却这样,无法显示控件:

    刚开始我还以为是模拟器的问题,然后切换回Google的模拟器(很卡)结果还是这样。还尝试过使用 Android x86的模拟器,然后报错了,错误大概如下

    Starting emulator for AVD 'AVD_for_Galaxy_Nexus_by_Google'
    emulator: WARNING: Classic qemu does not support SMP. The hw.cpu.ncore option from your config file is ignored.
    emulator: ERROR: x86 emulation currently requires hardware acceleration!
    Please ensure Intel HAXM is properly installed and usable.
    CPU acceleration status: Please disable Hyper-V before using the Android Emulator. Start a command prompt as Administrator, run 'bcdedit /set hypervisorlaunchtype off', reboot.
    
     
    
    cmd 管理员运行,
    
    bcdedit /set hypervisorlaunchtype off

    然后我尝试了 以管理员身份运行 cmd 并输入命令:bcdedit /set hypervisorlaunchtype off。再次运行 模拟器发现并不是这么简单:

    所以.....我就放弃了~ 

    后来在机缘巧合之下,我发现了....

     1 using Android.App;
     2 using Android.Widget;
     3 using Android.OS;
     4 
     5 namespace FirstAndroidTest
     6 {
     7     [Activity(Label = "FirstAndroidTest", MainLauncher = true, Icon = "@drawable/icon")]
     8     public class MainActivity : Activity
     9     {
    10         protected override void OnCreate(Bundle bundle)
    11         {
    12             base.OnCreate(bundle);
    13 
    14             // Set our view from the "main" layout resource
    15             // SetContentView (Resource.Layout.Main);
    16         }
    17     }
    18 }

    WTF!!!! SetContentView 怎么被注释了!!! 取消这行注释,立马用那个很卡的Android 模拟器运行,发现控件终于出来了!!原来是这样!!!!

    至于为什么 用那个很卡的Android模拟器,是因为之前执行了命令

    bcdedit /set hypervisorlaunchtype off

    想当然 应该执行

    bcdedit /set hypervisorlaunchtype on

    应该就可以恢复了吧?答案是错的(如下图)

    因为之前 执行 off的时候是需要重启计算机方能生效,而 执行on 也应该是需要重启计算机,但是重启计算机之后可以自动on吗?

    所以实行的应该是(参考:Turning hyper-v on and off):

    bcdedit /set hypervisorlaunchtype auto start

    重启后 Windows 的安卓模拟器回来了,第一个项目终于结束!

  • 相关阅读:
    用DirectX Audio和DirectShow播放声音和音乐(7)
    [转载]如何自学中医
    光照示例
    用DirectX Audio和DirectShow播放声音和音乐(5)
    DirectX 图形接口指南
    程序员的灯下黑:临渊羡鱼和退而织网
    使用DirectInput进行交互(3)
    Win32开发中最易踏上的地雷
    D3D中粒子效果实现示例
    用DirectX Audio和DirectShow播放声音和音乐(3)
  • 原文地址:https://www.cnblogs.com/godzza/p/6574277.html
Copyright © 2020-2023  润新知