visual studio 2017 android C# 项目调用 第三方 本地共享库(.so) 中的函数

1.创建目录并将  .so 文件复制到项目目录下。

2. 将编译选项调整为 AndroidNativeLibrary。

using Android.App;
using Android.Widget;
using Android.OS;
using System.Runtime.InteropServices;

namespace App2
{
    [Activity(Label = "App2", MainLauncher = true, Icon = "@drawable/icon")]
    public class MainActivity : Activity
    {
        [DllImport("TestDynamicSharedLib.so")]
        public extern static int getClickCount();

        protected override void OnCreate(Bundle bundle)
        {
            var c = getClickCount();

            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            // SetContentView (Resource.Layout.Main);
        }
    }
}

猜你喜欢

转载自www.cnblogs.com/nanfei/p/10298721.html
今日推荐