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

bundletool doesn't fetch the atrributes in styles.xml if there are more than one dpi. #128

Closed
baien opened this issue Nov 18, 2019 · 6 comments

Comments

@baien
Copy link

baien commented Nov 18, 2019

Describe the bug
I have an layout xml, which uses a textview, like this:

<TextView 
        android:id="@+id/title_text"
        android:layout_toRightOf="@id/app_icon"
        android:layout_marginLeft="10dip"
        android:layout_centerVertical="true"
        style="@style/title_text_style"
        android:text="@string/apps_locker_app_name"
        android:singleLine="true"
        android:lines="1"
        android:ellipsize="end"
        />

The style in the styles.xml is like this:

<style name="title_text_style">
     <item name="android:textSize">16sp</item>
     <item name="android:layout_width">wrap_content</item>
     <item name="android:layout_height">wrap_content</item>
</style>

however, I have 2 styles.xml in styles folder and styles-ldpi folder, the other style in ldpi is as follow:

<style name="title_text_style">
    <item name="android:textSize">20sp</item>
    <item name="android:layout_width">wrap_content</item>
    <item name="android:layout_height">wrap_content</item>
</style>

After using bundletool to install, the app always crash on the phone under Android 9. (Android 9 is ok) From the log it shows that I miss the layout_width in the layout xml file. If I remove the title_text_style style in the styles-ldpi, the app will launch without an error.

Bundletool version(s) affected
Version: [bundletool-all-0.11.0.]

Stacktrace
java.lang.RuntimeException: Binary XML file line #28: You must supply a layout_width attribute.

To Reproduce
in my case, use style to describe the layout_width in both styles folder and styles-ldpi folder, it will crash in all phones under Android 9

Expected behavior
No crashing.

Environment:
Android 8.0 and pre

@plecesne
Copy link
Contributor

Do you have a small project or AAB that reproduces the issue and that you could share with us so we can get a closer look?

@baien
Copy link
Author

baien commented Nov 19, 2019

It is very easy to verify. I just newed a HelloWorld project, and add a style named "title_text_style" in both styles under both folder values and values-ldpi as mentioned before. Remove the layout_width and layout_height attribute of the TextView in the HellowWorld and use the style=@style/title_text_style instead. build the abb, and install it with bundletool. The app will crash.
myapplication.zip

@baien
Copy link
Author

baien commented Nov 23, 2019

Do you have a small project or AAB that reproduces the issue and that you could share with us so we can get a closer look?

Hi, plecesne, is there any more information I could offer to help you look into this issue?

@plecesne
Copy link
Contributor

plecesne commented Dec 2, 2019

We have all the information we need, sorry for the delay, we will be looking into it as soon as possible.

@plecesne
Copy link
Contributor

plecesne commented Dec 2, 2019

Thanks to your project, I was able to reproduce, we're looking into the best way to fix the issue.

@ymakhno
Copy link
Collaborator

ymakhno commented Apr 23, 2020

Fixed in 0.14.0.

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

3 participants