防止 Proguard 删除特定的可绘制对象 [英] Prevent Proguard to remove specific drawables
本文介绍了防止 Proguard 删除特定的可绘制对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的 Android 项目中,我将一些图像存储在 res/drawable/中,这些图像仅可以从 Web 视图中加载的 HTML 文件中访问.例如(HTML 代码):
In my Android project, I have some images stored in res/drawable/ which are accessed only from an HTML file loaded in a Webview. For example (code in HTML):
<img src="file:///android_res/drawable/myfriend.png">
Proguard 在优化过程中从 apk 中删除了这些图像.
有人知道保存这些文件的方法吗(即使它们没有直接在 java 代码中使用)?
Does somebody know a way to keep these files (even if they are not used directly in the java code)?
推荐答案
我将图像移到了assets"文件夹,这解决了我的问题:
I moved the images to the 'assets' folder which solved my problem:
<img src="file:///android_asset/myfriend.png">
这篇关于防止 Proguard 删除特定的可绘制对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文