An error occurred while executing doInBackground(), java.lang.ClassCastException: com.zebra.rfid.RfidServiceMgr cannot be cast to b.a.b.a


Audience
Tags

I'm writing a Flutter/Android app that uses the RFIDAPI3Library, and it's base roughly off the SDK example app. It runs successfully when I run it in debug mode, but when I run it in release mode I get an error. Any ideas would be greatly appreciated

2021-07-21 15:12:59.325 9982-10009/? E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: com.sample.rfid, PID: 9982
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:325)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Caused by: java.lang.ClassCastException: com.zebra.rfid.RfidServiceMgr cannot be cast to b.a.b.a
at com.zebra.rfid.api3.e.a()
at com.zebra.rfid.api3.h3.()
at com.zebra.rfid.api3.n4.b()
at com.zebra.rfid.api3.c1.()
at com.zebra.rfid.api3.j1.o()
at com.zebra.rfid.api3.j1.b()
at com.sample.rfid.a$d.a()
at com.sample.rfid.a$d.doInBackground()
at android.os.AsyncTask$2.call(AsyncTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
at java.lang.Thread.run(Thread.java:761) 

Submitted by Kevin McKee on July 22, 2021 Permalink

Adding these 2 lines (minifyEnable, shrinkResources) to the Module's build.gradle file seems to have fixed the issue for me

buildTypes {
release {
minifyEnabled false
shrinkResources false
signingConfig signingConfigs.debug
}
}