Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/188.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何识别Xamarin.Android中的处理器架构?_Android_.net_Xamarin - Fatal编程技术网

如何识别Xamarin.Android中的处理器架构?

如何识别Xamarin.Android中的处理器架构?,android,.net,xamarin,Android,.net,Xamarin,假设大多数android处理器都是ARM类型的,但为了测试,模拟器大多是x86类型的。我需要一个只在ARM上运行的本机库,我只想为x86添加虚拟代码,以便创建单元测试。我知道简单的try/catch就足够了,但问题是我想用虚拟代码为单元测试创建接口 我试过了 System.Reflection.PortableExecutableKinds peKind; System.Reflection.ImageFileMachine machine; ty

假设大多数android处理器都是ARM类型的,但为了测试,模拟器大多是x86类型的。我需要一个只在ARM上运行的本机库,我只想为x86添加虚拟代码,以便创建单元测试。我知道简单的try/catch就足够了,但问题是我想用虚拟代码为单元测试创建接口

我试过了

        System.Reflection.PortableExecutableKinds peKind;
        System.Reflection.ImageFileMachine machine;
        typeof(object).Module.GetPEKind(out peKind, out machine);
我为.net找到了各种答案,但在安卓系统中,我总是得到x86,尽管我在设备上运行应用程序,但它并没有给我正确的答案

  type(object).Assembly.GetName().ProcessorArchitecture 
始终返回x86。

您可以使用来帮助确认设备是ARM还是Intel x86()
armeabi-v7a
还是
x86

IList<string> abis = Android.OS.Build.SupportedAbis;
您可以使用来帮助确认设备是ARM还是Intel x86()
armeabi-v7a
还是
x86

IList<string> abis = Android.OS.Build.SupportedAbis;