tahreem
tahreem

Reputation: 63

Getting java.lang.UnsatisfiedLinkError: No implementation found for error

I am using a third party library for printing purposes in my Kotlin Android app. I am getting this error when running the application and clicking the print button.

I have added the .so files in the jniLibs folder. Can anyone help me with this. I can share the project as well but you will need a physical printer from the company I am using this SDK from.

[![> Fatal Exception: java.lang.UnsatisfiedLinkError: No implementation

found for int com.icod.serial.SerialPort.native_open(java.lang.String, int, int, int) (tried Java_com_icod_serial_SerialPort_native_1open and Java_com_icod_serial_SerialPort_native_1open__Ljava_lang_String_2III) at com.icod.serial.SerialPort.native_open(SerialPort.java) at com.icod.serial.SerialPort.open(SerialPort.java:76) at com.szsicod.print.io.SerialAPI.openDevice(SerialAPI.java:36) at com.szsicod.print.escpos.PrinterAPI.connect(PrinterAPI.java:370) at com.tahreem.testmasungapplication.MainActivity.printIcod(MainActivity.kt:97)]

Image attached

Image

Upvotes: 1

Views: 3297

Answers (2)

vivek
vivek

Reputation: 1112

I faced this error due to small case instead of capital case of Java in c++ file. Make sure first letter java should be capital.

// I used small case of java as you can see below. This is erroneous.
    extern "C" JNIEXPORT jstring JNICALL
    java_com_vst_local_myapplication_TamperUtils_appSignature(JNIEnv *env, jobject /* this */) {
        return env->NewStringUTF("test string");
    }


 // This is correct one as I used capital case of first letter.
    extern "C" JNIEXPORT jstring JNICALL
    Java_com_vst_local_myapplication_TamperUtils_appSignature(JNIEnv *env, jobject /* this */) {
        return env->NewStringUTF("test string");
    }

Upvotes: 0

tahreem
tahreem

Reputation: 63

The issue was fixed long time ago. Had to reimplement everything from scratch.

  1. Added the JAR file in the libs folder.
  2. Run the JAR file inside the android studio so that it can install all its components inside the folder.
  3. Add all the other .SO files.
  4. Used a third party library for converting View to Bitmap and used to send the same bitmap for printing. Available on github-> implementation 'id.zelory:cekrek:1.0.0'
  5. Implement the methods for printing the project. Had to use the USB cable so as the printer works.

And it worked like a charm.

Upvotes: 1

Related Questions