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

Custom android attribute - Recompile Fail #775

Closed
iBotPeaches opened this issue Mar 18, 2015 · 7 comments
Closed

Custom android attribute - Recompile Fail #775

iBotPeaches opened this issue Mar 18, 2015 · 7 comments
Labels

Comments

@iBotPeaches
Copy link
Owner

Original issue 666 created by openappdev on 2014-08-09T08:32:23.000Z:

What steps will reproduce the problem?

1.Decompile and Recompile Apk file

What is the expected output? What do you see instead?
When using custom library attribute , need to recompile apk file without error

What version of the product are you using? On what operating system?
Windows 8
Apktool version: 2.0.0-dirty (Builded from git)

Please provide any additional information below.

Issue 1 With PagerSlidingTabStrip :

<LinearLayout android:orientation="vertical" android:clipChildren="false" style="@style/Match">
    <com.astuetz.PagerSlidingTabStrip  android:pstsShouldExpand="false"  />
    <android.support.v4.view.ViewPager android:id="@id/pager" style="@style/Match" />
</LinearLayout>

SNAPSHOT\res\layout\content_pager.xml:5: error: No resource identifier found for attribute 'pstsShouldExpand' in package 'android'

Issue 2 : With custom view

<com.myapp.android.app.widget.AspectRatioLayout  android:aspectRatio="@dimen/thumbnail_aspect_ratio">

\res\layout-sw600dp\list_item_single.xml:4: error: No resource identifier found for attribute 'aspectRatio' in package 'android'

Issue 3: oak library

<oak.widget.TextViewWithFont android:id="@id/title" android:oakFont="@string/font_light" style="@style/Font.Item" />

\res\layout\list_item_search.xml:5: error: Noresource identifier found for attribute 'oakFont' in package 'android'

Exception:

brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [C:
\Users\testuser\AppData\Local\Temp\brut_util_Jar_123662913771692459.tmp, p, --forced-package-id, 127, --min-sdk-version,
14, --target-sdk-version, 20, --version-code, 1017, --version-name, 1.0-SNAPSHOT, -F, C:\Users\testuser\AppData\Local\Tem
p\APKTOOL335103424956595181.tmp, -0, arsc, -I, C:\Users\testuser\apktool\framework\1.apk, -S, C:\Users\testuser\Desktop\HB
O Nordic-com.hbo.android.app-1017-v1.0-SNAPSHOT\res, -M, C:\Users\testuser\Desktop\TestApp
.0-SNAPSHOT\AndroidManifest.xml]
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:439)
at brut.androlib.Androlib.buildResources(Androlib.java:367)
at brut.androlib.Androlib.build(Androlib.java:290)
at brut.androlib.Androlib.build(Androlib.java:262)
at brut.apktool.Main.cmdBuild(Main.java:236)
at brut.apktool.Main.main(Main.java:88)

Note :
unfortunately I cannot send the apk file due to Non-disclosure agreement.

@iBotPeaches
Copy link
Owner Author

Comment #1 originally posted by connor.tumbleson on 2014-08-12T12:33:05.000Z:

I believe this might be a declare-styleable bug. Apktool's attr decoder doesn't handle these at all it seems.

This simple patch breaks the unit-tests by only adding 2 custom attributes within a block. I assume this is what those issues were using since they were custom attributes.

Needs more investigation, but confirmed with this patch since APK cannot be shared.

@iBotPeaches
Copy link
Owner Author

Comment #2 originally posted by rahmanrelevant on 2014-08-13T14:02:50.000Z:

Hi Connor.tumbleson,

I deployed your patch file standards in our project. The issues still persists. There is not much changes to the issue. We are currently experiencing the following, after deploying the patch file:

Attribute "oakFont" has already been defined
No resource identifier found for attribute 'oakFont' in package 'android'

I am also experiencing Absence of resource identifier, that is to be found in attributes such as 'aspectRatio', 'pstsShouldExpand','font' etc.

Please provide your inputs to the above technicalities.

@iBotPeaches
Copy link
Owner Author

Comment #3 originally posted by connor.tumbleson on 2014-08-13T14:10:39.000Z:

The patch had nothing to do with fixing anything. The patch file created failing unit-tests since you could not provide an APK. The patch allows this bug to be reproducible for anyone so other devs can investigate if they wish.

I have not researched the problem or investigated further. PRs are welcome though. I would start my research in the AttrDecoder.

@iBotPeaches
Copy link
Owner Author

Comment #4 originally posted by connor.tumbleson on 2014-08-16T19:10:33.000Z:

Custom attributes defined in are just moved to global status. IE

Original

Decoded

The type/name of the custom attributes are maintained. They just go from a scoped access to global, while this isn't a perfect 100% match from original to rebuilt, it still gets the job done. Since there is no APK due to NDA I believe the rest of the bug is a duplicate of 660 or close to that.

Maybe we will revisit this when we have less major bugs.

@iBotPeaches
Copy link
Owner Author

Comment #5 originally posted by rahmanrelevant on 2014-08-18T09:49:31.000Z:

As mentioned before, we cant share the APK due to confidentiality reasons.

However, we can walk through the source code through a web ex session.
Please provide your available date & time, along with your time zone you work in.

Note: I have sent you an email with the Resources folder attached to it. But, still I would want to discuss this issue with you over the webex session

Thanks

@iBotPeaches
Copy link
Owner Author

Comment #6 originally posted by rahmanrelevant on 2014-08-22T08:52:49.000Z:

Hi canon,

When we decompile apk with latest apk-tool, the above schemas are removed from apk manifest itself.any reason behind this?

StaticXmlSerializerWrapper MSYS Prefix::
StaticXmlSerializerWrapper MSYS Type::CDATA
StaticXmlSerializerWrapper MSYS AttributeName::style
StaticXmlSerializerWrapper MSYS Value::@style/Font.Item
StaticXmlSerializerWrapper MSYS NameSapce::
StaticXmlSerializerWrapper MSYS Prefix::
StaticXmlSerializerWrapper MSYS Type::CDATA
StaticXmlSerializerWrapper MSYS AttributeName::font
StaticXmlSerializerWrapper MSYS Value::@string/font_light
StaticXmlSerializerWrapper MSYS NameSapce::http://oak/oak/scheme
StaticXmlSerializerWrapper MSYS Prefix::oak
StaticXmlSerializerWrapper MSYS Type::CDATA
########################################################################
--------------------- ### 3###---------------------------------------------
StaticXmlSerializerWrapper MSYS pp.getText () ::null:oak.widget.TextViewWithFont
########################################################################
--------------------- ### 2###---------------------------------------------
StaticXmlSerializerWrapper MSYS pp.getText () ::null:oak.widget.TextViewWithFont
StaticXmlSerializerWrapper MSYS AttributeName::id
StaticXmlSerializerWrapper MSYS Value::@id/title

@iBotPeaches iBotPeaches added Bug and removed OpSys-All labels Mar 18, 2015
@iBotPeaches
Copy link
Owner Author

Closing this.

I tried my best without an apk making my own declare-styleable to try and duplicate. I cannot duplicate attributes being removed in the manifest no matter what I try locally.

In addition, all the attributes mentioned above do not experience a problem testing myself, which leads me to believe a framework issue as well.

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

No branches or pull requests

1 participant