2

Here is the rough idea of my files. I inherited a bunch of code that uses the public.xml file to map ids to themes. This code throws the error:

Error:(40, 24) Integer types not allowed (at 'theme' with value '0x7f09007a')

However, when I replace the android:theme="0x7f09007a" with android:theme="@style/myCoolTheme everything works. I need to be able to use these ids since so much more of the code I inherited uses them. Am I missing something to make the manifest file use the id mapping in public.xml?

app/src/main/res/AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest ...
    <application
       android:theme="0x7f09007a"
       ...
    </application>
</manifest>

app/src/main/res/values/public.xml

<?xml version="1.0" encoding="utf-8"?>
    <resources>
       <public type="style" name="myCoolTheme" id="0x7f09007a" />
       ...
    </resources>

app/src/main/res/values/style.xml

<resources>
    <style name="AppTheme" 
        ...
    </style>
    <style name="myCoolTheme" parent="@style/AppTheme" />
</resources>
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
natsuki_2002
  • 24,239
  • 21
  • 46
  • 50

2 Answers2

2

Referring to this post, I believe the use of @style/myCoolTheme is correct because you are using the name="myCoolTheme" of the public.xml.

The only purpose of the id="" attribute is to merge that integer value into R.java, not be referenced by the other XML files.

Community
  • 1
  • 1
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
0

Have you tried just renaming the name of the resource in the xml to be the same thing? Is it necessary to have the style be named "myCoolTheme"? If not, this may do the trick.

<?xml version="1.0" encoding="utf-8"?>
    <resources>
       <public type="style" name="0x7f09007a" id="0x7f09007a" />
       ...
    </resources

If renaming it isn't a problem, you can just use the following in the AndroidManifest.xml

android:theme="@style/0x7f09007a"a
Lyon12
  • 21
  • 5