Xamarin导入.so文件成功但无法找到文件的内容

时间:2015-06-17 09:26:16

标签: android xamarin xamarin.android

输出窗口提示:

06-17 17:01:32.600 D/Mono    (14927): Searching for 'getcpufamily'.
06-17 17:01:32.600 D/Mono    (14927): Probing 'getcpufamily'.
06-17 17:01:32.600 D/Mono    (14927): Could not find 'getcpufamily' due to 'Could not find symbol 'getcpufamily'.'.
and :   06-17 17:01:32.776 W/Trace   (14927): Unexpected value from nativeGetEnabledTags: 0

我的代码是:

[DllImport("libcheckcpu.so")]
public static  extern int getcpufamily();

1 个答案:

答案 0 :(得分:0)

它的架构是否正确?您是否为.so文件定义了ABI?是否标记为AndroidNativeLibrary

<ItemGroup>
    <AndroidNativeLibrary Include="path/to/libfoo.so">
        <Abi>armeabi</Abi>
    </AndroidNativeLibrary>
</ItemGroup>

以防这里是文档: http://developer.xamarin.com/guides/android/advanced_topics/using_native_libraries/ http://www.mono-project.com/docs/advanced/pinvoke/ 很确定你已经看过了。