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
msg.obj is TagInfo class which implemented Parcelable
need some help please.
2
Answers
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>
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.