Unsatisfied android link error when using any function from <math.h> among natives (NDK)

I get a known unsatisfied link error when I try to run a C ++ application on Android. I tried several ways to solve this problem and found out that when commenting all calls to math.h functions (for example, sin or sqrt ), the application starts up correctly.

I link my .so library only to libGLESv1_CM.a , and in Java I call:

 static { try { System.loadLibrary("GLESv1_CM"); System.loadLibrary("Game"); } catch(UnsatisfiedLinkError error) { Log.e("MyGame", "Failed to launch game"); } } 

Did I miss something?

+4
source share
1 answer

You must link it to libm. Add the following to your Android.mk file:

 LOCAL_LDLIBS += -lm 
+4
source

Source: https://habr.com/ru/post/1382493/


All Articles