If you have an Android app project that may have worked previously and you've recently migrated Android Studio to version 3.4 or later, check you dependencies and then check your proguard-rules.pro file if you are using one.
I recently ran into a situation using the DFU library from Nordic Semiconductor where downloading code to phones and then doing DFU of Nordic based BLE devices worked swimmingly. I then built a release version and.....kablooie! DFU File Error failure.
Turned out I needed the following in my proguard-rules.pro file:
-keep class no.nordicsemi.android.dfu.** { *; }
Generally, if you think you're having an issue with code in a given package, you might need
-keep class <package-name>.** { *; }
in your proguard-rules.pro file to prevent the new R8 compiler (replaces ProGuard now) from optimizing something you actually need.
See Android developer docs for more details: https://developer.android.com/studio/build/shrink-code#usage
I recently ran into a situation using the DFU library from Nordic Semiconductor where downloading code to phones and then doing DFU of Nordic based BLE devices worked swimmingly. I then built a release version and.....kablooie! DFU File Error failure.
Turned out I needed the following in my proguard-rules.pro file:
-keep class no.nordicsemi.android.dfu.** { *; }
Generally, if you think you're having an issue with code in a given package, you might need
-keep class <package-name>.** { *; }
in your proguard-rules.pro file to prevent the new R8 compiler (replaces ProGuard now) from optimizing something you actually need.
See Android developer docs for more details: https://developer.android.com/studio/build/shrink-code#usage