could not load library "libstdc++. so. 6" under System. LoadLibrary in Android

When I try to do System.loadLibrary("MyLib"); in android, the following happens in the static block:

Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: soinfo_link_image(linker.cpp:1640): could not load library "libstdc++.so.6" needed by "libMyLib.so"; caused by load_library(linker.cpp:750): library "libstdc++.so.6" not found

I don't know why it needs stdc++, or even what it is. There is no such thing in the dependencies of my library:

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <termios.h>
#include <time.h>
#include <errno.h>//-D_TS_ERRNO use for Solaris C++ compiler

#include <sys/select.h>//since 2.5.0

#ifdef __linux__
    #include <linux/serial.h>
#endif
#ifdef __SunOS
    #include <sys/filio.h>//Needed for FIONREAD in Solaris
    #include <string.h>//Needed for select() function
#endif
#ifdef __APPLE__
    #include <serial/ioss.h>//Needed for IOSSIOSPEED in Mac OS X (Non standard baudrate)
#endif

#include <jni.h>

I googled it. In linuska, this is solved simply by a string:

Sudo apt-get install lib32stdc++6

But in android, I can't do that. At the same time, in Linux and Windows, my libraries are connected and work without problems. Maybe an android wants me to compile the android libraries separately, using the NDK? Then how do people manage to use even other people's libraries without the source code?

Author: Eugene, 2016-11-16

1 answers

English speaker using Google Translate. Sorry if this is unclear!

You should use the NDK to create the Android library. The libraries installed on a typical Linux system are very different from those on Android.

People can use third-party libraries without a source, because these libraries were also built with the NDK.

 0
Author: Dan Albert, 2016-11-17 17:33:47