For example, exclude the drawbale of unnecessary devices such as ldtrl/watch brought in by androidx.appcompat:appcompat through Gradle configuration. Tried the following but none worked
1、
aaptOptions{
ignoreAssetsPattern 'drawable-nodpi-v4:drawable-mdpi-v4:drawable-ldrtl-xxxhdpi-v17:drawable-ldrtl-xxhdpi-v17:' +
'drawable-ldrtl-xhdpi-v17:drawable-ldrtl-xhdpi-v17:drawable-ldrtl-hdpi-v17:drawable-ldrtl-mdpi-v17' +
':drawable-watch-v20:layout-watch-v20'
}
2、
packagingOptions {
resources {
excludes += ['res/drawable-nodpi-v4/**',
'res/drawable-mdpi-v4/**',
'res/drawable-ldrtl-xxxhdpi-v17/**',
'res/drawable-ldrtl-xxhdpi-v17/**',
'res/drawable-ldrtl-xhdpi-v17/**',
'res/drawable-ldrtl-hdpi-v17/**',
'res/drawable-ldrtl-mdpi-v17/**',
'res/drawable-ldrtl-watch-v17/**',
'res/layout-watch-v20/**',
]
}
}
3、
android {
...
sourceSets {
main {
res {
exclude 'res/drawable-nodpi-v4/**'
exclude 'res/drawable-mdpi-v4/**'
exclude 'res/drawable-ldrtl-xxxhdpi-v17/**'
exclude 'res/drawable-ldrtl-xxhdpi-v17/**'
exclude 'res/drawable-ldrtl-xhdpi-v17/**'
exclude 'res/drawable-ldrtl-hdpi-v17/**'
exclude 'res/drawable-ldrtl-mdpi-v17/**'
exclude 'res/drawable-ldrtl-watch-v17/**'
exclude 'res/layout-watch-v20/**'
}
}
}
}
4、I also tried the solution under this link, but it didn’t work
Using Build-specific aaptOptions in Android (for excluding specific Assets files/folders)
enter image description here
New contributor
meng qing is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.