Proguard breaking audio file in assets or raw

前端 未结 3 810
小鲜肉
小鲜肉 2020-12-18 04:23

I have an activity that plays a beep sound with MediaPlayer that works fine and used to work fine even in the proguarded production version. With the latest release it now s

3条回答
  •  旧时难觅i
    2020-12-18 05:06

    I had a similar case where my app regressed after ProGuard (even in debug? though I've explicitly turned it off).

    08-30 22:10:32.360 561-18619/? E/FileSource: Failed to open file 'android.resource://com.mycompany.myapp/2131230720'. (No such file or directory)

    Eventually I had to add keep.xml file as suggested here under Customizing Which Resources to Keep

    with something like (@ /res/raw/keep.xml):

        
    
    
    

    You can ofcourse set it more explicitly but I only had mp3's on my RAW folder.

    My unzip -lv app-release.apk was showing my mp3 files as:

    0 Stored 0 0% 00-00-1980 00:00 00000000 res/raw/audio.mp3

    which was odd (0 bytes?!).

提交回复
热议问题