0

I have upgraded our app to Dexguard 5.3.28 (latest version) and we are facing a font related issue. I know that the new version of dexguard obfuscates assets and i think this might be the problem. With older version, like 5.0.34, we had no issues.

We store otf fonts in the assets/fonts/ directory. And use a custom TextView to set the font: xmlns:custom="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" />

Setting a font problematically works well but changing all the CustomTextViews is not an option. I tried to use -keepdirectories, -keep CusomTextView, but with no result.

UPDATE: For some reason I think the attr.xml file is obfuscated and something is wrong here.

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

Is there any way to don't obfuscated the attr.xml ? Or any other suggestions ?

robert
  • 127
  • 1
  • 10

1 Answers1

0

DexGuard indeed obfuscates and adapts resource XML files in a couple of ways. You may need to preserve the custom views that are referenced:

-keep class com.XXXX.XXXX.XXXX.XXX.CustomButton
-keep class com.XXXX.XXXX.XXXX.XXX.CustomTextView

Otherwise, contact us at Saikoa and we'll look into it in more detail.

Eric Lafortune
  • 45,150
  • 8
  • 114
  • 106