引用.so库,JNI使用方法

1、先将.so库放在libs下:

2、在工程模块下 的build.gradle配置:

复制代码
android的defaultConfig配置

不同的系统平台看项目需要

3、生成与so库中c文件的jni方法的一样包名的实体类以及方法

如C文件暴露的方法:

生成的类和包名对应为:

包名:com.haledev.jnimk,类名:JNITest,方法:public native int compress(String cmd);

其中,Hell为.so库除了lib和.so的字段,如:

相关推荐
Gracker1 分钟前
Android Perfetto 系列 07 - MainThread 和 RenderThread 解读
android
Gracker3 分钟前
Android Perfetto 系列 5:Android App 基于 Choreographer 的渲染流程
android
Gracker15 分钟前
Android Perfetto 系列 6:为什么是 120Hz?高刷新率的优势与挑战
android
apigfly1 小时前
Flutter,Compose,Web 在Android平台上从布局到屏幕的机制探究
android·flutter·webview
czhc11400756632 小时前
Java1112 基类 c#vscode使用 程序结构
android·java·数据库
從南走到北3 小时前
JAVA国际版打车APP打车顺风车滴滴车跑腿APP源码Android+IOS+H5
android·java·ios
独自破碎E3 小时前
从括号匹配到字符串解码:递归思想的巧妙应用
android·java·开发语言
只想搞钱的肥仔4 小时前
Android thermal (7)_thermal core
android
一氧化二氢.h4 小时前
MySQL root用户连接错误解决方法
android·数据库·mysql
QuantumLeap丶4 小时前
《Flutter全栈开发实战指南:从零到高级》- 13 -状态管理GetX
android·flutter·ios·前端框架