How to exclude resources from android shrinkResources?

可紊 提交于 2021-02-10 22:38:13

问题


How can I exclude all /res/raw/*.wav files from shrinking?

buildTypes {
    release {
        shrinkResources true
        minifyEnabled true
    }
}

回答1:


/res/raw/keep.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
           tools:keep="*.wav"/>



回答2:


Had a similar issue with two wav files - bell.wav and beep.wav in the res/raw/ folder. membersounds's answer above pointed the right direction, but did not solve the issue - this is the /res/raw/keep.xml that worked:

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
           tools:keep="@raw/bell,@raw/beep"/>


来源:https://stackoverflow.com/questions/45435215/how-to-exclude-resources-from-android-shrinkresources

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!