Search code examples
androidc++android-studiojava-native-interfacevisual-studio-2015

Android Studio 1.3 and C++ static libraries


I'm currently working on generating a static C++ library to wrap with JNI use with Android. Using Visual Studio 2015's new support for Android C++ libraries, I was able to generate a dynamic library (.so), and pulled it into Android Studio. Once it was in the proper directory, it was able to link properly, and I was able to call a native method.

However, doing exactly the same thing, but generating a static library (.a), I continuously got UnsatisfiedLinkError, indicating the library was not found by the app. Everything else was controlled for (i.e. same build settings, same location of the library in the file system, etc).

Has anybody else tried doing this? Is there something special that needs to be done to get Android Studio to recognize .as?


Solution

  • Turns out Android Studio just doesn't support Java 8 yet (and with it, support for linking static C++ libraries). So Microsoft is a little ahead of the game with their support for creating those static libraries. Guess it's dynamic linking for the time being.

    enter image description here