CANNOT LINK EXECUTABLE error. How to Add Runtime Libs to NDK Compiled Code

  android, android-ndk, android-studio, apk, c++

I have a c++ application, specifically a device driver(no gui), that I wrote for linux and built with a makefile. I want this driver to run on an android device(arm64 running android 29), so I compiled the driver successfully on my linux machine by using the android NDK standalone toolchain in my makefile and liked with the appropriate arm64 dependencies.

When I push the code to the android via adb shell and try to run, I get the error:

CANNOT LINK EXECUTABLE "./gdriver": library "libudev.so.1" not found

The driver has a whole bunch of similar dependencies, so I have some questions:
Where do I place the libraries/headers so the android can find them at runtime?
Is there a way to package my compiled NDK executable with the libraries as an apk or similar in Android Studio?
Is there a way to package it so it runs out of the box?

Source: Windows Questions C++

LEAVE A COMMENT