本文介绍了即使将supportRtl设置为false,Android Studio也会生成R-T-L资源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的手电筒应用程序,在调试时,我注意到我的apk的res文件夹中有多个RTL(从右至左)布局文件夹.因此,我用它搜索了一下,并将清单文件中的 supportsRtl 属性设置为false,该属性以前为true.但是即使进行了此更改,文件夹仍然存在.我尝试过重建项目或清理项目,但没有用.这些文件夹的名称类似于 drawable-ldrtl-hdpi-v17 ,而其他名称则类似于 drawable-ldrtl-mdpi-v17 ,xhdpi,xxhdpi等.对于v-17后缀,我感到很惊讶因为我的最小sdk版本为21.它们还包含abc_ic_menu_copy_mtrl_am_alpha.png之类的文件,这对我来说似乎很奇怪.有人可以帮我阻止这些文件的生成,因为它们不必要地增加了我的apk大小.任何帮助都会很棒.

I have a simple flashlight app in which while debugging, I noticed that there are several RTL (Right to left) layout folders in the res folder of my apk. So I googled it and set supportsRtl attribute to false in my manifest file which was previously true. But even after this change the folders are still present. I have tried rebuilding the project or clean the project but of no use. The folders are named like drawable-ldrtl-hdpi-v17 and others like drawable-ldrtl-mdpi-v17 , xhdpi, xxhdpi etc. I am surprised at v-17 suffix because my min sdk version is 21. Also they contain files like abc_ic_menu_copy_mtrl_am_alpha.png which seems weird to me. Can someone please help me to prevent these files from being generated as they unnecessary increase my apk size. Any help would be great.

推荐答案

如果您不想要它们,请删除它们. Android Studio不会进入并删除已经生成的文件,因为它不知道您是否打算以后使用它们.

Delete them if you don't want them. Android Studio doesn't go in and delete already generated files, because it doesn't know if you plan on using them later.

这篇关于即使将supportRtl设置为false,Android Studio也会生成R-T-L资源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 13:08