我已将我们的应用升级到Dexguard 5.3.28(最新版本),我们正面临与字体相关的问题。我知道新版本的dexguard会混淆资产,我认为这可能是问题所在。 对于旧版本,如5.0.34,我们没有任何问题。
我们将otf字体存储在assets / fonts /目录中。并使用自定义TextView设置字体: 的xmlns:定制= “http://schemas.android.com/apk/res/com.XXXX.XXXX.XXXX.XXX”
<com.XXXX.XXXX.XXXX.XXX.CustomTextView
android:id="@+id/custom_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:ellipsize="end"
android:singleLine="true"
android:textColor="@android:color/white"
android:textSize="20sp"
custom:font="roman" />
设置字体有问题但效果不错,但不能更改所有CustomTextViews。 我尝试使用-keepdirectories,-keep CusomTextView,但没有结果。
更新 出于某种原因,我认为attr.xml文件是混淆的,这里有些问题。
<attr name="font">
<enum name="light" value="1"/>
<enum name="roman" value="2"/>
</attr>
<declare-styleable name="com.XXXX.XXXX.XXXX.XXX.CustomButton">
<attr name="theme">
<enum name="gray" value="1"/>
<enum name="light_gray" value="2"/>
<enum name="pinger_blue" value="3"/>
</attr>
<attr name="font"/>
</declare-styleable>
<declare-styleable name="com.XXXX.XXXX.XXXX.XXX.CustomTextView">
<attr name="font"/>
</declare-styleable>
<declare-styleable name="CustomEllipsizedTextView">
<attr name="ellipsizeAtLine" format="integer"/>
</declare-styleable>
有没有办法不混淆attr.xml?还是其他任何建议?
答案 0 :(得分:0)
DexGuard确实以几种方式模糊和调整资源XML文件。您可能需要保留引用的自定义视图:
-keep class com.XXXX.XXXX.XXXX.XXX.CustomButton
-keep class com.XXXX.XXXX.XXXX.XXX.CustomTextView
否则,请联系我们Saikoa,我们会更详细地研究它。