Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Deobfuscation of declare-styleable in attrs.xml #247

Closed
kismeter opened this issue Apr 3, 2018 · 3 comments
Closed

Deobfuscation of declare-styleable in attrs.xml #247

kismeter opened this issue Apr 3, 2018 · 3 comments

Comments

@kismeter
Copy link

kismeter commented Apr 3, 2018

there's declare-styleable in attrs.xml, when decompiled, the declare-styleable is not recoginzed, only attrs

@bagipro
Copy link
Collaborator

bagipro commented Apr 29, 2020

Please attach a test apk and reopen the issue

@bagipro bagipro closed this as completed Apr 29, 2020
@swearl
Copy link

swearl commented Feb 24, 2023

here is my code

in jadx

R

public final class R {
    public static final class styleable {
        public static final int StrokeTextView_gradientOrientation = 0x00000002;
        public static final int StrokeTextView_strokeColor = 0x00000000;
        public static final int StrokeTextView_strokeWidth = 0x00000001;
        public static final int UISwitch_bmHeight = 0x00000001;
        public static final int UISwitch_bmWidth = 0x00000000;
        public static final int UISwitch_sliderHeight = 0x00000003;
        public static final int UISwitch_sliderWidth = 0x00000002;
        public static final int[] StrokeTextView = {R.attr.strokeColor, R.attr.strokeWidth, R.attr.gradientOrientation};
        public static final int[] UISwitch = {R.attr.bmWidth, R.attr.bmHeight, R.attr.sliderWidth, R.attr.sliderHeight};
    }
}

attr.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <attr name="bmWidth" format="dimension">
    </attr>
    <attr name="bmHeight" format="dimension">
    </attr>
    <attr name="sliderWidth" format="dimension">
    </attr>
    <attr name="sliderHeight" format="dimension">
    </attr>
    <attr name="strokeColor" format="color">
    </attr>
    <attr name="strokeWidth" format="dimension">
    </attr>
    <attr name="gradientOrientation">
        <enum name="horizontal" value="0" />
        <enum name="vertical" value="1" />
    </attr>
</resources>

i think the correct code is

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="StrokeTextView">
        <attr name="strokeColor" format="color" />
        <attr name="strokeWidth" format="dimension" />
        <attr name="gradientOrientation">
            <enum name="horizontal" value="0" />
            <enum name="vertical" value="1" />
        </attr>
    </declare-styleable>
    <declare-styleable name="UISwitch">
        <attr name="bmWidth" format="dimension" />
        <attr name="bmHeight" format="dimension" />
        <attr name="sliderWidth" format="dimension" />
        <attr name="sliderHeight" format="dimension" />
    </declare-styleable>
</resources>

@jpstotz
Copy link
Collaborator

jpstotz commented Feb 26, 2023

@swearl Please provide a sample APK so we can reproduce the problem. Without an APK, it is unlikely we can fix this problem.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants