Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Decode lost declare-styleable in attrs.xml #1217

Open
hulinyun opened this issue Apr 6, 2016 · 6 comments
Open

Decode lost declare-styleable in attrs.xml #1217

hulinyun opened this issue Apr 6, 2016 · 6 comments

Comments

@hulinyun
Copy link

hulinyun commented Apr 6, 2016

Information

  1. Apktool Version (2.1.0) -
  2. Operating System ( Windows) -
  3. APK From? (Other) -

Steps to Reproduce

  1. in eclipse ide attr.xml
<resources>
    <declare-styleable name="SelectableRoundedImageView">
        <attr name="sriv_left_top_corner_radius" format="dimension" />
        <attr name="sriv_right_top_corner_radius" format="dimension" />
        <attr name="sriv_left_bottom_corner_radius" format="dimension" />
        <attr name="sriv_right_bottom_corner_radius" format="dimension" />
        <attr name="sriv_border_width" format="dimension" />
        <attr name="sriv_border_color" format="color" />
        <attr name="sriv_oval" format="boolean" />
        <attr name="android:scaleType" />
    </declare-styleable>
</resources>

2.use eclipse build xxx.apk
3.java -jar tools/apktool_2.1.0.jar d -f -s xxx.apk
in xxx/res/values/attr.xml

<resources>
    <attr name="sriv_left_top_corner_radius" format="dimension" />
    <attr name="sriv_right_top_corner_radius" format="dimension" />
    <attr name="sriv_left_bottom_corner_radius" format="dimension" />
    <attr name="sriv_right_bottom_corner_radius" format="dimension" />
    <attr name="sriv_border_width" format="dimension" />
    <attr name="sriv_border_color" format="color" />
    <attr name="sriv_oval" format="boolean" />
</resources>

Questions to ask before submission

1.'declare-styleable' lost ,it's a bug?
2.It will affect me to make new R.java
3.Thank you for your effort :)

@iBotPeaches
Copy link
Owner

See #775 . Attributes inside a declare-styleable are moved outside into global scope. APKs didn't seem broken from this and no APKs were provided.

@zhuowei
Copy link

zhuowei commented Apr 20, 2016

@iBotPeaches This is an issue if the output of Apktool is used to create an Android library for building with Ant instead of being rebuilt with Apktool: the Ant buildtools won't generate an R.styleable and the resulting library will crash.

@iBotPeaches
Copy link
Owner

While apktool is used in a multitude of ways, using it during the build of a library seems weird. Generally if you have source at that point, apktool wouldn't be needed. I looked into this before and I was fairly sure in the compiled form declare-styleable is gone.

I'll check again to confirm.

@dipcore
Copy link

dipcore commented Sep 4, 2016

I'm trying to decode framework-res.apk and use the decoded resources in a custom sdk. I want to use it with the android studio. Decoding seems lost declare-styleable tags, and I'm having a lot of issues in the android studio.

@xuefengboy
Copy link

@iBotPeaches This is an issue if the output of Apktool is used to create an Android library for building with Gradle instead of being rebuilt with Apktool: the Gradle build won't generate an R.styleable and the resulting library will crash.

@GotKiCry
Copy link

GotKiCry commented Jul 4, 2022

i just think R.styleable is array containing R.attr , what if decode the R.styleable content , maybe can restore styleable.xml @iBotPeaches

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

No branches or pull requests

6 participants