Apktool
Apktool copied to clipboard
Decode lost declare-styleable in attrs.xml
Information
- Apktool Version (
2.1.0) - - Operating System ( Windows) -
- APK From? (Other) -
Steps to Reproduce
- 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 :)
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.
@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.
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.
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.
@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.
i just think R.styleable is array containing R.attr , what if decode the R.styleable content , maybe can restore styleable.xml @iBotPeaches