Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Android DFU Library reporting file not found when file exist

We have an Android DFU App built around the Android-DFU-Library. We developed it several years ago and were updating it to support some new devices. 

The app downloads the file and then tries to initiate the DFU service. The file does exist because before starting the DFU we do a 

val localFile = File(filesDir,downloadUri.lastPathSegment)
uri = Uri.fromFile(localFile)
if (localFile.exists())
{

Then with the URI that is checked in the code above we start the DFU with

val starter = DfuServiceInitiator(bluetoothService?.connectedPeripheral?.address()!!)
.setDeviceName(bluetoothService?.connectedPeripheral?.bluetoothGatt?.device?.name)
.setKeepBond(false)
starter.setZip(uri!!)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
DfuServiceInitiator.createDfuNotificationChannel(this@ScanAndUpdateActivity)
}
controller = starter.start(this@ScanAndUpdateActivity, DfuService::class.java)

It gives an error in

inner class DfuProgressListener : DfuProgressListenerAdapter(){
...
override fun onError(deviceAddress: String, error: Int, errorType: Int, message: String) {

The error message is "DFU FILE NOT FOUND" and the error=4097 and the errorType=0

Any advice on what I need to do to get the file to the DFU library in a way it will accept it would be appreciated.

Looking at the uri in the debugger I see it's file:///data/user/0/com.lezyne.SensorAlly/files/LezyneCAD_V1_4b.zip

Thank you

Related