Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run app in Debug Working well, but build Release is crash! #5

Open
nguyenthao1988 opened this issue Feb 27, 2021 · 2 comments
Open

Comments

@nguyenthao1988
Copy link

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!

@bhaveshbusa
Copy link

@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.

@dan12321
Copy link

dan12321 commented Aug 31, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants