In the docks, an example of developing an application in Eclipse, everything works. I transfer the project in AndroidStudio, does not work, can not find libraries from * .so files! I tried all the options, made my own JAR, created the Gradle packaging script, created a folder and threw the * .so library there, nothing helps, the same message is always the same:

10-16 13:18:38.030: W/dalvikvm(5101): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/atol/drivers/fptr/IFptrNative; 10-16 13:18:38.030: W/dalvikvm(5101): threadid=1: thread exiting with uncaught exception (group=0x41869438) 10-16 13:18:38.050: E/AndroidRuntime(5101): FATAL EXCEPTION: main 10-16 13:18:38.050: E/AndroidRuntime(5101): java.lang.ExceptionInInitializerError 10-16 13:18:38.050: E/AndroidRuntime(5101): at com.atol.drivers.fptr.IFptr.create(IFptr.java:14) 10-16 13:18:38.050: E/AndroidRuntime(5101): at ru.gc986.testprintserver.printlib.printers.Atol_11.<init>(Atol_11.java:26) 

An error occurs at the time the object is created using the JAR library. She, in turn, pokes in * .so files, but cannot find what she needs. Who is to blame and what to do?


The solution was suggested on the website of Atol, the object must be placed in the folder - app / src / main / jniLibs / armeabi, and the jar is in the folder - app / src / main / libs, and only then everything starts working!

  • Try creating the jniLibs folder in the app\src\main directory if another path is not specified in build.gradle , and put .so there. - temq
  • I just tried it again as you indicated, but the result is the same. - gc986
  • I could be wrong, but Android Studio and gradle are bad friends with the NDK. They are recommending work with them for the time being from under Eclipse - Vladyslav Matviienko
  • The fact is that I do not compile the library, but try to connect the already created one. I also heard that they are not very friendly, but I recently updated the studio to 1.4, they say that this version of NDK should already be adequate. - gc986

1 answer 1

It is necessary to put *.so libraries by breaking them into armeabi , mips and x86 platforms in some directory and specify the path to the directory in the gradle script:

 android { sourceSets { main { jniLibs.srcDirs = ['libs'] } } } 

So works for me without questions.

  • Put, indicated, now a new error: 10-16 15:40:58.438: W/dalvikvm(6628): threadid=1: thread exiting with uncaught exception (group=0x41869438) 10-16 15:40:58.438: E/AndroidRuntime(6628): FATAL EXCEPTION: main 10-16 15:40:58.438: E/AndroidRuntime(6628): java.lang.UnsatisfiedLinkError: Couldn't load libfptr: findLibrary returned null - gc986
  • one
    So the format does not like the linker. Where do you take it at all? Throw a link. - Barmaley
  • On Atol-a site - atol.ru/link/file/699 In the same place and the instruction to it - atol.ru/link/file/697 - gc986
  • This link does not help? stackoverflow.com/questions/11872692 - Barmaley
  • Now I’ll try, but as I understand it shouldn’t help, as the manufacturer provides the JAR library which itself accesses the * .so files in its internal functions. Rebuild jar fail. - gc986