Custom attribute not resolved inside styles and th

2020-04-05 06:52发布

I have android application with custom themes which was developed 2-3 year ago. I had this stylable in my attr.xml resouce file:

<declare-styleable name="EVETextViewPlus">
    <attr name="customFont" format="string" />
    <attr name="pageStripFont" format="string" />
</declare-styleable>

And I've used this inside my style_warm.xml resource file:

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android"
    <style name="style_display_page_title_warm">
        <item name="my.app.package.:pageStripFont">fonts/b_titr.ttf</item>
        <item name="android:textSize">25dp</item>
        <item name="android:textColor">@color/colorDisplayPageTitle</item>
    </style>
....

When I'm going to sign my app, it checks for errors and prompts:

Cannot resolve symbol 'my.app.package:pageStripFont'

I should mention my.app.package is package name of my application defined in manifest.

This is piece of code which was working until 2 years ago and when I migrated my application to latest android SDK tools, Gradle and androidX, this error was eventually appeared and I don't know what's wrong.

I did see this answer, this one but I could not find the problem.

I also checked this and this which see more revelant but I did not realize how to fix the error.

1条回答
▲ chillily
2楼-- · 2020-04-05 07:23

Replace this

<item name="my.app.package.:pageStripFont">fonts/b_titr.ttf</item>

with this

<item name="pageStripFont">fonts/b_titr.ttf</item>
查看更多
登录 后发表回答