Run app in Debug Working well, but build Release is crash!
I'm using Samsung Galaxy A7, Android 8.0. I working print brother label QL_720NW. Run App Debug Print working, but app build release is crash app!
@Srinivas11789, @YonathanZetune , @nguyenthao1988
This is little bit off topic. I have exactly the same problem. I am connecting QL_820NWB via bluetooth.
Printing works in Debug mode but fails when trying to StartCommunication.
printer.setPrinterInfo(settings); printer.startCommunication();
I have requested permission for external storage, set the workPath and tried bunch of other things
F art : art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: fid == null F art : art/runtime/check_jni.cc:65] in call to GetIntField F art : art/runtime/check_jni.cc:65] from void com.brother.ptouch.sdk.JNIWrapper.initJNI(com.brother.ptouch.sdk.h)
Checking if you guys have some pointers.
I ran into the same error, not with this repo but when using the brother SDK. The issue in my case was ProGuard obfuscating the classes/methods/properties in com.brother.ptouch.sdk so they no longer matched with the native libraries (paraphrasing top answer from https://stackoverflow.com/questions/38151653/proguard-error-a-jni-error-has-occured). The result is that when the SDK tries to use the libraries with JNI (Java Native Interface), it crashes.
So the solution for me was to add -keep class com.brother.ptouch.sdk.** { *; } to my ProGuard configuration.
This contains more information on obfuscation in android https://developer.android.com/studio/build/shrink-code
while running app in debug mode print works for me but when release apk or build apk getting error here Thread({ if (printer.startCommunication()) { val result: PrinterStatus = printer.printImage(bitmap); if (result.errorCode != ErrorCode.ERROR_NONE) { Log.d("TAG", "ERROR - " + result.errorCode); } printer.endCommunication(); } }).start(); is there any solution please let me know @Srinivas11789 @YonathanZetune @dan12321