如何在AAR中引用SO文件?

时间:2019-12-11 10:40:07

标签: android gradle

aar文件中有一些SO文件,我希望在我的项目中使用这些文件。我应该如何写CMakeList.txt和build.gradle文件?

build.gradle


dependencies {
    implementation 'example:example:1.7.11' // <--- SO file exists in this dependency
}

AAR文件结构

│  AndroidManifest.xml
│  classes.jar
│  R.txt
│
├─arm64-v8a
├─armeabi-v7a
├─jni
│  ├─arm64-v8a
│  │      libAK.so
│  │      libAKCompat.so
│  │
│  ├─armeabi-v7a
│  │      libAK.so   <--- Suppose I need this document
│  │      libAKCompat.so
│  │
│  ├─x86
│  │      libAK.so
│  │
│  └─x86_64
│          libAK.so
│
├─x86
└─x86_64

CMakeList.txt

cmake_minimum_required(VERSION 3.4.1)
add_library(example SHARED IMPORTED)
# How to set the value of example-file
set_target_properties(example 
        PROPERTIES IMPORTED_LOCATION
        ${example-file}) <---

target_link_libraries(myself_ndk_module example ${log-lib})

0 个答案:

没有答案