简体   繁体   中英

How to exclude resources from android shrinkResources?

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

buildTypes {
    release {
        shrinkResources true
        minifyEnabled true
    }
}

/res/raw/keep.xml :

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

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"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM