Android studio 引用 so文件
时间: 2024-01-21 17:37:44 浏览: 185
在Android Studio中引用so文件有几种方法可以选择。
方法一:在main文件夹下创建一个文件夹jniLibs,然后将so文件放入该文件夹中。修改build.gradle文件,在android{}下添加productFlavors和sourceSets的配置。具体配置如下:
```
...
android {
...
productFlavors {
x86 {
ndk {
abiFilter "x86"
}
}
mips {
ndk {
abiFilter "mips"
}
}
armv7 {
ndk {
abiFilter "armeabi-v7a"
}
}
arm {
ndk {
abiFilter "armeabi"
}
}
fat
}
sourceSets.main {
jniLibs.srcDir 'src/main/jniLibs'
}
}
...
```
这样配置后,so文件就会被正确地引用到项目中了。<em>1</em><em>2</em><em>3</em>
#### 引用[.reference_title]
- *1* [Android Studio 引用so文件](https://blog.csdn.net/zouchengxufei/article/details/46486629)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
- *2* *3* [Android逆向之旅-Android Studio的调用So文件极简教程(2022最新版Android Studio2021.3.1,踩坑版)](https://blog.csdn.net/qq_41866988/article/details/127604501)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
[ .reference_list ]
阅读全文