user1725145
user1725145

Reputation: 4042

No resource found that matches the given name (at 'theme' with value '@android:style/Theme.my_theme').(APT0000)

I recently installed Xamarin Android brand new (version 5.10.1 build 6). When I tried to add a theme, I got the dreaded "No resource found..." error.
It is the first theme I have tried to add, so I am not sure if the problem could be due to something I've written in my code. Searching on StackOverflow and the Xamarin fora however, I discovered that the issue probably means that some Android library is not installed.

So I have installed a lot more stuff from the latest and previous APIs, as well as from Extras, but am still getting the same error.
The app is just a simple app aimed at phones, so I didn~t install wear or tv libraries. How far back do I have to go with Android APIs?
And is there anything that I should install that isn't obvious?

There are a lot of answers out there already for this particular error, but many of them are vague, and don't give exact instructions, or refer to components that I don't recognise, I think because I am using Xamarin.

Here is my theme code.

<?xml version="1.0" encoding="UTF-8" ?>
<resources>
  <style name="Theme.my_theme" parent="@android:style/Theme.DeviceDefault.Light.DialogWhenLarge">
    <item name="android:textColor">#00FF00</item> <item name="android:typeface">monospace</item> <item name="android:textSize">20sp</item>
  </style>
</resources>

Here is the manifest.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="My_app.My_app">
    <uses-sdk android:minSdkVersion="17" />
    <application android:label="My_app" android:theme="@android:style/Theme.my_theme" android:icon="@drawable/icon"></application>
</manifest>

Here is the Android manager showing what is installed. Is there something obvious that is not installed?

androidmanager1 androidmanager2 androidmanager3 androidmanager4

Upvotes: 2

Views: 3264

Answers (1)

matthewrdev
matthewrdev

Reputation: 12180

The expression @android:style/Theme.my_theme is pointing to a resource named Theme.my_theme within the android namespace instead of your local app package.

Change android:theme="@android:style/Theme.myTheme" to android:theme="@style/Theme.myTheme" to fix the error.

Upvotes: 5

Related Questions