skip to Main Content

I am working on a flutter project that integrate RFID android pistol device to the application.
Using pigeon to communicate to native android api.
While debuging android studio at RFID device I ca read RFID tag and send them to flutter method to handle read tags.

problem occurs only when I build application to release

Flutter application android side is kotlin

here are some code

val tagInfos =intent.getParcelableArrayExtra(EXTRA_TAG_INFO)
      
val msg = Message.obtain(mUIHandler, MSG_REFRESH_RESULT_LIST, tagInfos)
mUIHandler.sendMessage(msg)

getting tag information from intent pass them to message handler

        override fun handleMessage(msg: Message) {
            when (msg.what) {
                MSG_REFRESH_RESULT_LIST -> {
                    val results = msg.obj as Array<Parcelable>
                    assetResult(results)
                }
            }
        }

and this is the

val results = msg.obj as Array<Parcelable>

where application crashed at release version. not debug.

this image has results values and types

enter image description here

msg.obj is TagInfo class which implemented Parcelable

enter image description here

need some help please.

2

Answers


  1. Chosen as BEST ANSWER

    Added proguard rule for android project. Apparently when building release version of an app android changes class that RFID tag information has. Error was Cast Exception throwig at this line val results = msg.obj as Array<Parcelable>

    -keep class com.nlscan.android.uhf.** { *; }
    

  2. You could try using a try-catch block and implement Timber in the catch to capture logs. It’s difficult to troubleshoot without knowing the specific error.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search