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

error: resource 'drawable/$avd_hide_password__0' has invalid entry name '$avd_hide_password__0'. Invalid character '$avd_hide_password__0'. #22

Closed
Lanchon opened this issue May 30, 2019 · 5 comments

Comments

@Lanchon
Copy link
Member

Lanchon commented May 30, 2019

UPDATE: solution here

so far this is caused by the same 6 files in all apps i've seen. i suppose these malformed files come from a google library.

these files are part of two very similar and complementary animated vector drawables:

1) avd_show_password

==> res/drawable-v21/avd_show_password.xml <==

    <?xml version="1.0" encoding="utf-8"?>
    <animated-vector android:drawable="@drawable/$avd_show_password__0"
      xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt">
        <target android:name="eye_mask" android:animation="@drawable/$avd_show_password__1" />
        <target android:name="strike_through" android:animation="@drawable/$avd_show_password__2" />
    </animated-vector>


==> res/drawable-v21/$avd_show_password__0.xml <==

    <?xml version="1.0" encoding="utf-8"?>
    <vector android:height="24.0dip" android:width="24.0dip" android:viewportWidth="24.0" android:viewportHeight="24.0"
      xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt">
        <path android:name="strike_through" android:pathData="@string/path_password_strike_through" android:strokeColor="@android:color/white" android:strokeWidth="1.8" android:strokeLineCap="square" />
        <group>
            <clip-path android:name="eye_mask" android:pathData="@string/path_password_eye_mask_strike_through" />
            <path android:name="eye" android:fillColor="@android:color/white" android:pathData="@string/path_password_eye" />
        </group>
    </vector>


==> res/drawable-v21/$avd_show_password__1.xml <==

    <?xml version="1.0" encoding="utf-8"?>
    <objectAnimator android:interpolator="@android:interpolator/fast_out_linear_in" android:duration="@integer/show_password_duration" android:valueFrom="@string/path_password_eye_mask_strike_through" android:valueTo="@string/path_password_eye_mask_visible" android:valueType="pathType" android:propertyName="pathData"
      xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" />


==> res/drawable-v21/$avd_show_password__2.xml <==

    <?xml version="1.0" encoding="utf-8"?>
    <objectAnimator android:interpolator="@android:interpolator/fast_out_linear_in" android:duration="@integer/show_password_duration" android:valueFrom="1" android:valueTo="0" android:propertyName="trimPathEnd"
      xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" />

2) avd_hide_password

==> res/drawable-v21/avd_hide_password.xml <==

    <?xml version="1.0" encoding="utf-8"?>
    <animated-vector android:drawable="@drawable/$avd_hide_password__0"
      xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt">
        <target android:name="eye_mask" android:animation="@drawable/$avd_hide_password__1" />
        <target android:name="strike_through" android:animation="@drawable/$avd_hide_password__2" />
    </animated-vector>


==> res/drawable-v21/$avd_hide_password__0.xml <==

    <?xml version="1.0" encoding="utf-8"?>
    <vector android:height="24.0dip" android:width="24.0dip" android:viewportWidth="24.0" android:viewportHeight="24.0"
      xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt">
        <path android:name="strike_through" android:pathData="@string/path_password_strike_through" android:strokeColor="@android:color/white" android:strokeWidth="1.8" android:trimPathEnd="0.0" android:strokeLineCap="square" />
        <group>
            <clip-path android:name="eye_mask" android:pathData="@string/path_password_eye_mask_visible" />
            <path android:name="eye" android:fillColor="@android:color/white" android:pathData="@string/path_password_eye" />
        </group>
    </vector>


==> res/drawable-v21/$avd_hide_password__1.xml <==

    <?xml version="1.0" encoding="utf-8"?>
    <objectAnimator android:interpolator="@android:interpolator/fast_out_slow_in" android:duration="@integer/hide_password_duration" android:valueFrom="@string/path_password_eye_mask_visible" android:valueTo="@string/path_password_eye_mask_strike_through" android:valueType="pathType" android:propertyName="pathData"
      xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" />


==> res/drawable-v21/$avd_hide_password__2.xml <==

    <?xml version="1.0" encoding="utf-8"?>
    <objectAnimator android:interpolator="@android:interpolator/fast_out_slow_in" android:duration="@integer/hide_password_duration" android:valueFrom="0" android:valueTo="1" android:propertyName="trimPathEnd"
      xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" />

the problematic $avd_(show|hide)_password__<n>.xml files of these composite resources are never referenced from code. they are only referenced from their corresponding main resource files avd_(show|hide)_password.xml.

this allows a simple workaround: you can manually rename the problematic files to make their names valid, along with their references in the main resource files. you can choose any names you want, but simply removing the dollar signs should be fine.

this workaround is a temporary stopgap measure. i'll be investigating ways to handle these corner cases in a more automated way.

@renaudcerrato
Copy link

Thanks! Will look into that.

@reed07
Copy link

reed07 commented Jun 9, 2019

Would you be able to elaborate on the workaround of renaming the avd files?
At which point in the build process should this be performed--to the source apk? If so, my apk in question has some resources in a binary resources.arsc file which have references to these files. I'm not aware of an easy way to edit an arsc file.

@Lanchon
Copy link
Member Author

Lanchon commented Jun 13, 2019

hi,

take a look at the apk-lib sample: one suproject produces an .apklib file and another consumes it. unlink the 2 projects by feeding the second project the apklib as a file (place it in directory apklib and it will be picked up by default). once you've done that, you can edit the apklib file: the resources are decompiled there. was this clear enough?

@Lanchon
Copy link
Member Author

Lanchon commented Jun 27, 2019

UPDATE: solution here

@Lanchon
Copy link
Member Author

Lanchon commented Nov 13, 2021

@eladkarako you are posting on an obsolete thread. which solution did not work? the linked solution is also obsolete. the proper solution is here: https://github.com/DexPatcher/dexpatcher-gradle/releases/tag/v2.0.0

the solution didn't worked for me
and I even got the most recent aapt2 binary from https://maven.google.com/...

the solution works. if you are using binaries for google then you are not following the instructions. go back and reread the howto.

if you have an issue, please don't resurrect dead obsolete issues: create a new thread describing your particular issue.

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