c++ - Linking External Libraries in Android Studio (gradle) -
i using android studio. added header files in jni
folder , added libraries in jnilibs
folder , added path in build.gradle
file.
sourcesets.main { jni.srcdir 'src/main/jni' jnilibs.srcdir 'src/main/jnilibs' }
but getting undefined reference error
. searched on net , solutions block automatic ndk-build
call , edit android.mk
file , running ndk-build
call terminal. want link external libraries in build.gradle
file.
secondly getting undefined reference 'std::ios_base::init::init()'
error. linked library
ldlibs "stdc++"
but still getting error. using cross compiled libraries , header files , think need link libraries provided cross compiler. did
ldlibs "/home/xx/xx/xx/xx/arm-linux-androideabi/lib/stdc++"
but still getting error. solution it?
to declare stl in build.gradle
, use:
stl "gnustl_static"
ldlibs
reserved other libs.
extract build.gradle
:
defaultconfig { ndk { modulename "mymodule" cflags "-std=c++11 -frtti -fexceptions" ldlibs "atomic -llog" stl "gnustl_static" } }
Comments
Post a Comment