Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom attribute not resolved inside styles and theme

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.

like image 446
VSB Avatar asked Jul 19 '19 15:07

VSB


1 Answers

Replace this

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

with this

<item name="pageStripFont">fonts/b_titr.ttf</item>
like image 125
Jignesh Mayani Avatar answered Nov 04 '22 01:11

Jignesh Mayani