The android doc here states that I can target Api Level 8+ devices and still specify that I want to use the Holo theme for devices that are API Level 11+. I should be able to do this using two themes.xml files :
One would go in /Resources/values for devices of API Level 8, 9 and 10
One would go in /Resources/values-v11 for devices with API Levels 11+
In a Xamarin.Android project, using Xamarin Studio it doesn't look like it's working, I get a compile time error :
Error retrieving parent for item: No resource found that matches the given name '#android:style/Theme.Holo'.
Am I doing something wrong here ? Is there a workaround ?
Theme.Holo is only available on API 11 and above.
If your project target is set to automatic, the system will build against the minimum level required (I think).
Try explicitly setting it to a higher API version.
Related
I'm trying to use downloadable fonts introduced in API 26 and apparently backward compatible with API 14 when the support library is used. How do I use it, though?
Using android:fontFamily causes Android Studio to show a warning and the fonts are not applied on API < 16:
android:fontFamily requires API level 16 (current min is 14)
When app: namespace is used as the documentation says, the build fails with
Error: No resource found that matches the given name: attr 'app:fontFamily'.
I know that only about 1% of devices are running API < 16, but I'd still like to know what I'm doing wrong.
I research material design project for 4.x API, It seem too many problems in style values, always style.... (in v-21) not found. I think v-21 is only build with api 21. But I want to build for 4.x API, do anyone know problem?
Here is some project in Github i found:
https://github.com/wasabeef/awesome-android-ui
https://github.com/rey5137/material
I use eclipse too. Change ANdroid API 21,22,23 but it still not work
The Log say : no resource found that matches the given name "TextAppearance.Appcompat.Body1"
Here is my picture:
OTHER QUESTION:
The Author say this material project can run on API 2.x -> 4.x , but why it need to build with API 21 -> 23? So can lower device can run it?
Set compileSdkVersion 23 or 21 or above in your build.gradle file.
The Log say : no resource found that matches the given name
"TextAppearance.Appcompat.Body1"
This is because you might not have imported AppCompat Library to your Eclipse Project.
The Author say this material project can run on API 2.x -> 4.x , but
why it need to build with API 21 -> 23? So can lower device can run
it?
Yes, Its always a good practice to build your App with the latest API version as this will include all the updated resources which might be not available in previous versions of Android. However, this will not affect your APK size in anyways.
I am trying context.getExternalFilesDirs(null) to get paths for mounted storages. I intend to use this method keeping in view the new restrictions imposed by android in Kitkat. When I write statement to make a call to the method it gets underlined in RED with message as shown in image below:
I have checked all installations required to support API level 19 and everything seems fine.
My application is targeted for API 19 with minimum sdk version set to 16.
I have checked it a lot and looks like no one has faced this issue. I don't know what can possibly go wrong here but if you have any idea that where I am doing wrong please identify. Thank you
This is how I resolved the above issue.Right side click on Project -> Properties -> Android -> set Project Build Target to > Android 4.4.2 -> Apply
Check the documentation ,
getExternalFilesDirs()
has been added with API 19, and your min SDK is 16, you have to check that when you run on devices less than API 19 and there by organize your functionalities.You can Use TargetAPI annotation and then red underline will be removed.
As per guidelines here for Android L development, I used android:elevation property in my application, but it shows the following error:
No resource identifier found for attribute elevation in package
android
I am using eclipse and I have downloaded the latest version just 2 days ago.
I have also set my target sdk as API level 21 and minimum as API level 14. I have also installed the latest updates on sdk-build tools shown in sdk manager.
Anyone know the solution? plz help me.
1) Select Project > Right Click > Properties > Check Android L > apply > Ok
2) android:minSdkVersion="L"
Hope this will work for you.
One thing worth noting is that Android Lollipop corresponds to API level 21. There is no such thing (yet) as API level 22.
You should be able to solve your problem by setting android:minSdkVersion and android:targetSdkVersion to "21".
Select Project, then Properties, then Android and tick Android 5.0. Ignore all the answers telling you to set android:minSdkVersion. Android is designed to ignore stuff inside elements it does not understand just so that in this case you can apply elevation when running on lollipop devices and it is ignored on earlier devices.
You can hide the remaining lint warning in the xml file by adding tools:ignore="NewApi" in the element. This needs xmlns:tools="http://schemas.android.com/tools" specified in the root element.
AppCompat v21 allows a fair bit of Material Design to be used on pre-lollipop devices, but I've yet to work out how to add it to a project in Eclipse.
android:elevation or View.setElevation() is introduced since Android API 21. So, if you set android:minSdkVersion="14", it's not OK. android:minSdkVersion="14" is integrant.
I have a question about minSDK. I took a project example in here: Contacts Providers.
This project has a minSDK = 5. And in styles.xml some attribute which require higher sdk version like:
android:textAllCaps --> min 14
android:fontFamily --> min 16
But that project so no any error and run fine.
When I copy some style into my styles.xml in my project. It causes an error:
android:textAllCaps requires API level 14 (current min is 11)
...
Can someone help me with the compile error?
You can use those styles in the respective minSDK version by using resource qualifiers. In your resource directory: there is base styles, add folders to res/styles-v14 (for use in ice-cream sandwich and greater, where minSDK is 14) and styles-v16 (so on so forth if you need the styles to be applied when available)
Now when the style needs a higher SDK version, place it in respective style resource directory. textAllCaps goes into styles-v14, android:fontFamily goes into styles-v16.
More can be found here on resource qualifiers ;)
http://developer.android.com/guide/topics/resources/providing-resources.html
Hope this helps buddy, happy coding!
EDIT: previously misunderstood the question/scenario. Sorry!
I think the problem is your Target API level. Make sure that the target api level is at least the level in which the APIs were introduced. In this case, 14.
If you build from command line you would just do
android update project -p -t
(I think what the command does is just update project.properties and sets target=android-14)