I want to apply holographic theme when my app runs on 3.0 or higher and use default dialog theme when run on < 3.0.
For that I tried Change theme according to android version. I set the target sdk version = 11 to work for holographic theme in 3.0 and above and it is working for my simple dialog activity (without changing project.properties file android version) but if i declare the same for my library project holo theme is not inherited when I run my app on 3.0 or higher device. It shows dialogs with old theme.
I dont want to change my project.properties file android version.
I don't understand why it is not working in my library project. I also tried creating values-v11 folder and adding but I'm getting the error:
Description Resource Path Location Type error: Error: No resource found that matches the given name (at 'theme' with value '#android:style/Theme.Holo.Light').AAPT Problem
Please help me, I'm stuck.
Related
I'm trying to use the CoordinatorLayout in my Xamarin.Android app. I've been using a custom theme with Theme.Material.Light as its parent, which worked fine before I added the CoordinatorLayout. When I add it, I get an error telling me I have to use a Theme.AppCompat theme, but as soon as I do the app fails to build and gives me the following error:
/{project directory}/Resources/values/Styles.xml(0,0):
Error APT0000: Error retrieving parent for item:
No resource found that matches the given name
'#android:style/Theme.AppCompat'. (APT0000) (TnpApp.Android)
This answer suggests installing the major version of the support library that matches the Android SDK I'm using. I've tried this (I think I did everything correctly), but it doesn't help.
Does anyone have any ideas?
I'm using Xamarin Studio on Mac.
UPDATE 1
I tried the following code in MainActivity.cs in a clean Xamarin.Android project, and build fails with the same error.
namespace ThemeTest
{
[Activity(Label = "ThemeTest", MainLauncher = true, Icon = "#mipmap/icon", Theme = "#android:style/Theme.AppCompat.Light")]
public class MainActivity : Activity
{
// ...
}
}
UPDATE 2
I removed all the folders from /user/.local/share/Xamarin except for Mono for Android and zips as suggested in this answer. I closed Xamarin Studio and reopened it. I tried to deploy the app, and Xamarin reinstalled all the packages but the build failed with the original error.
I was able to fix this problem by simply removing #android:style/ from the style element's parent tag in my Styles.xml file. So what looked like this...
<style name="MyCustomTheme" parent="#android:style/Theme.AppCompat">
Now looks like this...
<style name="MyCustomTheme" parent="Theme.AppCompat">
I'm shocked the solution is this simple, but it works. :) I got the idea from this code.
I'm developing in Visual Studio 2015/Xamarin and saw this same problem. While I still don't understand the cause or the fix for this problem, this thread did point me in the right direction which seems to have more to do with resaving styles.xml (for my development environment) than anything else.
My styles.xml did not have #android:style/ and I still had the error mentioned above. As described in another proposed solution, I added
<style name="MyCustomTheme.Base" parent="Theme.AppCompat" />
before <style name="MyCustomTheme" parent="Theme.AppCompat">, saved styles.xml and rebuilt my project without errors. I then removed
<style name="MyCustomTheme.Base" parent="Theme.AppCompat" />,
resaved styles.xml and rebuilt with no errors. Visually, my styles.xml is unchanged, but the error is gone.
If you recently installed a google play service related package (firebase for example , but there are many others) , it is possible that this installation messed up with your CSproj and your package.json files (look at your version control history to see if these files were changed), and modified your target api version : Going from target Api 25 to Target 26 for exemple etc.
If this is the case , you should adresse this problem one of two ways :
make sure you download the sdk version that you are now targeting , to do this , go to TOOLS > SDK manager.
or revert back to your old target , by discarding the change the package made to you csproj and package.json files and clean and rebuild.
When I import the Support Library v7 into my workspace in eclipse, I get this error:
error: Error retrieving parent for item: No resource found that
matches the given name '#style/ Theme.Holo.Light'.
I have another library project that both link to the appcompat library. The funny thing is that I can build and run my project fine when I remove the styles.xml for values-v14. So I can work without Holo theme but it seems really strange that I lose the styles that should be there?
I'm working in eclipse with latest ADT. I've tried cleaning my project, closing / opening eclipse and the project and re-importing the appcompat into my workspace. Also setting the build target to 19 for both of the linked library projects
Any help would be appreciated
Try using Theme.AppCompat.Light instead reference
It appeared to be a problem with Eclipse/ADT and I have fixed it now. Basically I had previously removed the values-v14/styles.xml file and then at a later date copied the values-v11/styles.xml back into the values-v14 folder. However it didn't properly recognise that it was now in v14 styles.
The solution was to delete the values-v14/styles.xml and add a new one.
Hi I am having an old app created on version 2.2.3.
I am modifying the app for 4.0 and above version handsets.
can someone tell me if I can use selective theme
like for 2.2 devices dark black theme
For 3.0 and above the holo
Can i use version specific themes?
Create a different values folder with following name:
values-v17
and put a copy of style.xml init
in this style.xml you can overrite styles set in default values folder and for the devices with API-17 this style will be applied
If you have a folder for values-v11 all the devices with API level 11 and more will refer to files from this folder.
I recently changed my Project Build Target from Android 2.3.3 to Google APIs and from this time I get an error from the values-v11 folder which says
error: Error retrieving parent for item: No resource found that
matches the given name 'android:Theme.Holo.Light'.
Maybe I need to remove that folder or there is something else I can do to include this theme in my app
2.3.3 is doesn't have the Holo styles and resources. So, it will give this error.
You have two options:
Remove those styles
Switch to latest SDK
BTW, any specific reason of using build target as 2.3.3? You could have the target set to the latest version, and run your app on 2.3.3 as well.
I have imported Support4Demos project from Android SDK (from directory extras/android/support/samples/Support4Demos/) into eclipse.
Initially I got more than 800 errors.
After adding android-support-v4.jar library to build path still more than 100 errors exist.
Probably all of them have the same cause - R class is not generated due to error in XML file.
error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo'.
As I understood - Holo Theme is missing..
Project is imported "as is" - no modifications were made. So I expect that should work.
Where is the Holo Theme? It is not part of Android SDK?
Which file should I copy to which directory?
Or should I add some reference?
The problem is very likely that Holo theme is for Android SDK 4.x and above and you are using some older SDK in your project. You are probably importing samples from a recent API and your project is using an older one.
Solutions are (descending order of how good the solution is):
Import samples targeted at the SDK you wish to use.
or
Change the theme of the sample.
or
Set up your project with a newer Android API (eg. +4.x).
You can also check this question: Trying to use holo theme in Android not working
Problem solved... I mean.
When project is imported into eclipse project.properties file is created. My eclipse creates file with target=8 inside. Probably it is lowest version which is installed. But I am not sure.
Holo theme is not part of Android Support Library so project should be compiled with Project Build Target set to platform version containing Holo Theme (3.0 or higher - API 11 or higher). It can be done via eclipse menu Project->Properties->Android or directly in project.properties file. eclipse automatically updates reference to the right version of android.jar platform library. Note that targetSdkVersion in AndroidManifest.xml has no effect (or?). I have this unchanged line in AndroidManifest.xml:
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="13" />
I have installed platforms of version 8, 10, 13 and 16. Project cannot be compiled with API level 13 due to another compatibility problem in AndroidManifest.xml.
So I can successfully build project only with platform version 4.1 (API level 16) - in other words with target=16 in project.properties file.
Small problem with running application - eclipse shows only Android 4.1 AVD (others are considered as incompatible and are hidden. My Samsung Galaxy Y Duos is showing also as incompatible, but application can run on it.