简体   繁体   中英

Add pre-built NDK library (.so file) to Android project

I inherited an Android project which includes a sub-project to build a JNI library from C source. I want to remove the C source and include pre-built library instead. Based on tips I found here and there, I copied the .so files from the .apk to paths like: app/src/main/jniLibs/armeabi-v7a/libxcore.so But, when I tried to build the app I get "cannot find symbol" errors for classes defined in the library. I'm guessing I need to add something to build.gradle that points to the .so files, but am very new to Java/Android/Gradle and can't figure out what. Tried a variety of things suggested here, with no luck. Thanks for any help.

The error had nothing to do with the location of the .so files, but with the fact that the library sub-project I deleted also contained some Java sources. Once I added back the original library project, and deleted only the C sources, everything worked fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM