问题
How can I add a .cpp class (like speex or opus) into my android studio project ? I already tried to insert using externalNativeBuild like :
externalNativeBuild {
ndkBuild {
arguments "NDK_APPLICATION_MK:=Application.mk"
abiFilters "armeabi", "armeabi-v7a", "x86"
cFlags "-I\$(LOCAL_PATH)/jnispeex.cpp -I\$(LOCAL_PATH)/jnicelt11.cpp -I\$(LOCAL_PATH)/jnicelt7.cpp -I\$(LOCAL_PATH)/jniopus -D__EMX__ -DUSE_KISS_FFT -DFIXED_POINT -DEXPORT='' -DHAVE_CONFIG_H -fvisibility=hidden -DOPUS_BUILD -DVAR_ARRAYS -Wno-traditional -DFIXED_POINT"
}
}
but it does't work. I will be so appreciated if anyone helps
回答1:
you should use CMakelists.txt
for your Android NDK build and configure your CPP files inside the Cmakelists.txt
. Some related links for your reference:
https://stackoverflow.com/a/51182431/8034839
Where to place JNI/native libraries in Android Studio Project
来源:https://stackoverflow.com/questions/52125375/add-cpp-classes-into-android-project