androidjlayer

JLayer sometimes unable to load resource 'sfd.ser'


I'm using jl-1.0.1 to convert mp3 files to wav files for an android app. Most of the time it works fine on my phone but occasionally I get a java.io.IOException: unable to load resource 'sfd.ser'. A tester is reporting this happening everytime for him.

The answer to this question suggested using JLayer 1.0 but that didn't work for me JLayer exception when trying to play audio file

Any suggestions greatly appreciated

logcat from my phone: enter image description here enter image description here

Testers bug report: enter image description here

Code where problem is occurring:

fun decodeWavFromMp3(context: Context, mp3File: String, wavFile: String) : ByteArray{
    val file = File(wavFile)
    file.delete()

    var converter = Converter()
    converter.convert(mp3File, wavFile)

    var byteArray = context.contentResolver.openInputStream(Uri.fromFile(file))!!.readBytes()

    return byteArray.copyOfRange(44, byteArray.size)    
}

Solution

  • Turns out the problem was in the apk I gave to my tester. Generating the apk with minifyEnabled set to true caused the issue. Still not sure why I get the very occasional crash on other phones though.