Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

add sensor linker using android cmake

I'm developing a c++ plugin to get android sensor data.

when I compile my shared library using android-cmake toolchain I've got a linker error :

error: undefined reference to 'ASensorManager_getInstance'

How can I add the right library (-landroid or -lsensor I guess) to the compilation using android-cmake?

Thanks

like image 460
kakou Avatar asked Jun 29 '26 19:06

kakou


1 Answers

I found the solution, just add this in your CMakeLists.txt :

set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -landroid")

Hope this will be useful for others

like image 101
kakou Avatar answered Jul 01 '26 09:07

kakou



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!