BreadFish64
BreadFish64

Reputation: 33

Why aren't my native libraries copied into the apk?

I am trying to build an android application with a few native libraries. NDK builds the libraries successfully, and I can see them in ...\app\.externalNativeBuild\cmake\debug\arm64-v8a\src\<library>\lib<library>.a

But when I run the app I get an unsatisfied link error and when I analyze the APK, the native libraries are nowhere to be found; only libc++_shared.so. Here's the relevant portion of the app's build.gradle:

externalNativeBuild {
    cmake {
        version "3.10.2"
        path "../../../CMakeLists.txt"
    }
}

defaultConfig {
    externalNativeBuild {
        cmake {
            arguments "-DENABLE_QT=0", // Don't use QT
                    "-DENABLE_SDL2=0", // Don't use SDL
                    "-DANDROID_ARM_NEON=true", // cryptopp requires Neon to work
                    "-DENABLE_CUBEB=0",
                    "-DANDROID_STL=c++_shared"

            abiFilters 'arm64-v8a'

            targets "citra-android"
        }
    }
}

Upvotes: 0

Views: 197

Answers (1)

liushuyu
liushuyu

Reputation: 26

If you are asking about this repository, then, your issue lies in src/android/app/src/main/cpp/CMakeLists.txt:

add_library(citra-android STATIC
        dummy.cpp
        )

You are supposed to use SHARED instead of STATIC for Gradle to generate a shared object file (.so) instead of a .a file.

Hope it helps, thanks.

Upvotes: 1

Related Questions