add cpp classes into android project
add cpp classes into android project
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
-I
so how should i address that the source files?
– Shakib Karami
Sep 1 at 6:25
In your
Android.mk
file(s).– Michael
Sep 1 at 15:24
Android.mk
1 Answer
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:
CMakelists.txt
Cmakelists.txt
https://stackoverflow.com/a/51182431/8034839
Where to place JNI/native libraries in Android Studio Project
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
The
-I
compiler option is to specify paths, not source files.– πάντα ῥεῖ
Sep 1 at 6:23