Android support library appcompat v7: cannot find actionModeShareDrawable resource - android

I reinstalled the v7 appcompat library from the SDK manager in Eclipse. However, the library itself is telling me errors exist in several different xml files.
This is one of the theme files:
<resources>
<style name="Base.V14.Theme.AppCompat" parent="Base.V11.Theme.AppCompat" />
<style name="Base.V14.Theme.AppCompat.Light" parent="Base.V11.Theme.AppCompat.Light" />
<style name="Base.V14.Theme.AppCompat.Dialog" parent="Base.V11.Theme.AppCompat.Dialog" />
<style name="Base.V14.Theme.AppCompat.Light.Dialog" parent="Base.V11.Theme.AppCompat.Light.Dialog" />
<style name="Base.Theme.AppCompat" parent="Base.V14.Theme.AppCompat">
<item name="android:actionModeCutDrawable">?actionModeCutDrawable</item>
<item name="android:actionModeCopyDrawable">?actionModeCopyDrawable</item>
<item name="android:actionModePasteDrawable">?actionModePasteDrawable</item>
<item name="android:actionModeSelectAllDrawable">?actionModeSelectAllDrawable</item>
<item name="android:actionModeShareDrawable">?actionModeShareDrawable</item>
</style>
<style name="Base.Theme.AppCompat.Light" parent="Base.V14.Theme.AppCompat.Light">
<item name="android:actionModeCutDrawable">?actionModeCutDrawable</item>
<item name="android:actionModeCopyDrawable">?actionModeCopyDrawable</item>
<item name="android:actionModePasteDrawable">?actionModePasteDrawable</item>
<item name="android:actionModeSelectAllDrawable">?actionModeSelectAllDrawable</item>
<item name="android:actionModeShareDrawable">?actionModeShareDrawable</item>
</style>
<style name="Base.Theme.AppCompat.Dialog" parent="Base.V14.Theme.AppCompat.Dialog">
<item name="android:actionModeCutDrawable">?actionModeCutDrawable</item>
<item name="android:actionModeCopyDrawable">?actionModeCopyDrawable</item>
<item name="android:actionModePasteDrawable">?actionModePasteDrawable</item>
<item name="android:actionModeSelectAllDrawable">?actionModeSelectAllDrawable</item>
<item name="android:actionModeShareDrawable">?actionModeShareDrawable</item>
</style>
<style name="Base.Theme.AppCompat.Light.Dialog" parent="Base.V14.Theme.AppCompat.Light.Dialog">
<item name="android:actionModeCutDrawable">?actionModeCutDrawable</item>
<item name="android:actionModeCopyDrawable">?actionModeCopyDrawable</item>
<item name="android:actionModePasteDrawable">?actionModePasteDrawable</item>
<item name="android:actionModeSelectAllDrawable">?actionModeSelectAllDrawable</item>
<item name="android:actionModeShareDrawable">?actionModeShareDrawable</item>
</style>
</resources>
And the error:
error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Any thoughts?

The Eclipse section of this answer might help you to solve the problem.
You have to do is to open the project.properties file of the android-support-v7-appcompat and change the target from target=android-19 to target=android-21. The do a Clean for your project, restart your eclipse to take effect.

Right mouse click on v7 appcompat library project -> Properties -> Android -> make sure Android 5.0 is selected as Project Build Target.

Its about targeting the correct version of android version.
goto
Window>Android Sdk Manager>
See whether you are having the required version SDK Build Tools which can be found at top section of android sdk manager.
If you updated recently and deleted old Sdk Build tools that can be an issue too.
Please re-install the required tools.
Always remember don't delete the old Sdk Tools after updating to new ones.
Hope this Helps you.

Related

Change Xamarin.Android Api Version

I already set all Api versions to Api 23 in the Android project properties, but it doesn't seems to help. This is the errorcode I always get:
Could not find android.jar for API Level 25. This means the Android
SDK platform for API Level 25 is not installed. Either install it in
the Android SDK Manager (Tools > Open Android SDK Manager...), or
change your Xamarin.Android project to target an API version that is
installed. (C:\Program Files
(x86)\Android\android-sdk\platforms\android-25\android.jar missing.)
I already tried to switch to Api Version 25 but I don't get an update for Xamarin.Forms and therefore I can't update the other packages.
Edit:
If I update the SDK to Level 25 and try to deploy I receive the following Errors:
The error occurs in the file style.xml:
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MainTheme" parent="MainTheme.Base">
</style>
<!--Base theme applied no matter what API-->
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
<item name="windowNoTitle">true</item>
<!--We will be using the toolbar so no need to show ActionBar-->
<item name="windowActionBar">false</item>
<!--Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette
colorPrimary is used for the default action bar background-->
<item name="colorPrimary">#2196F3</item>
<!--colorPrimaryDark is used for the status bar-->
<item name="colorPrimaryDark">#1976D2</item>
<!--colorAccent is used as the default value for colorControlActivated
which is used to tint widgets-->
<item name="colorAccent">#FF4081</item>
<!--You can also set colorControlNormal, colorControlActivated
colorControlHighlight and colorSwitchThumbNormal.-->
<item name="windowActionModeOverlay">true</item>
<item name="android:datePickerDialogTheme">#style/AppCompatDialogStyle</item>
</style>
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">#FF4081</item>
</style>
</resources>
If you already changed the API Version, try to install the Nougat 7.1 SDK (Api Level 25). If that is already done, clean %USER%\AppData\Local\Xamarin, clean your solution and install what you need.

Eclipse Android 2.2 project error but Android 4.0 no error

When I create new project for lower android 2.2 label API8 in eclipse there are some error and i can't fixed them. appcompat_v7 inside some problem no found values-v17 - values-v21 and there are also some error my project folder.
After creating ... ...
But when I create project for higher android 4.0 label API(14) there are no error.
After creating ... ...
There are any way to solve this problems.
In 4.0 they use android: prefix for styles but in 2.2 they does not recognise
In 4.0
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CodeFont" parent="#android:style/TextAppearance.Medium">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">#00FF00</item>
<item name="android:typeface">monospace</item>
</style>
</resources>
in 2.2
<style name="WindowTitle">
<item name="singleLine">true</item>
<item name="textAppearance">#style/TextAppearance.WindowTitle</item>
<item name="shadowColor">#BB000000</item>
<item name="shadowRadius">2.75</item>
</style>
like wise things changed. So refer the android developer.android.com
Or you can use separate stylesheet from 2.2 . And also without seen the style.xml we cant say that this is the exact problem.
You need to modify your style.xml to ensure API's are supported. Please check this SO post Android AppCompat requires API level 11
This should help you solve the problem you face.

how to use material design features in api lower than 21 in eclipse?

there are many questions regarding this but not even single helped me.
So please tell me how to enable material design features in eclipse.
i have also imported appcompat_v7 library in project but it does not create a folder with name values_v21 which helps in using those feature i think.
So please help me out in this
here is my styles.xml file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/AppTheme_ActionBar</item>
<item name="android:actionBarSize">#dimen/action_bar_height</item>
<item name="android:windowContentOverlay">#drawable/actionbar_shadow</item>
<item name="android:homeAsUpIndicator">#drawable/ic_ab_up_compat</item>
<item name="android:actionBarTabTextStyle">#style/tabtextcolor</item>
<item name="android:actionOverflowButtonStyle">#style/AppTheme_ActionBar_Overflow</item>
</style>
<style name="AppTheme_ActionBar" parent="android:Widget.Holo.ActionBar.Solid">
<item name="android:background">#color/apptheme_primary</item>
<item name="android:actionBarTabTextStyle">#style/tabtextcolor</item>
<item name="android:icon">#drawable/actionbar_icon_placeholder_compat</item>
<item name="android:titleTextStyle">#style/AppTheme_ActionBar_Title</item>
</style>
<style name="AppTheme_ActionBar_Title" parent="android:TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#android:color/white</item>
<item name="android:textSize">20sp</item>
</style>
<style name="AppTheme_ActionBar_Overflow" parent="android:Widget.ActionButton.Overflow">
<item name="android:src">#drawable/ic_ab_overflow_compat</item>
</style>
<style name="tabtextcolor" parent="#android:style/Widget.Holo.Light.ActionBar.TabText">
<item name="android:textColor">#android:color/white</item>
</style>
</resources>
There are some points you should check:
Import into eclipse, last version of android-support-v7-appcompat
project. You should update via SDK Manager, and import project from {your_path_to_android_sdk}/extras/android/support/v7/appcompat
Add this project as library dependency to your project
In styles.xml use Theme.AppCompat.Light or Theme.AppCompat:
style name="AppTheme" parent="#style/Theme.AppCompat.Light"
A simple guideline:
import the appcompat-v7 project and add it as a library dependency for your project
let your theme inherit some of the appcompat themes. For example <style name="Theme.MyTheme" parent="Theme.AppCompat.Light">
Note that not all widgets (ui elements) are material-styled by appcompat
Follow the examples and explanations in the android-developers blogspot.
The values-vXY folders are used to add specific resources for a specific platform. For example you might add a style (in a values-v21 folder) that inherits some of the material styles that are built-in and available only one api level 21+. These folders are created manually and are only used if you want an alternative resource for a specific platform level. They are used when you want your app to fit better in all/many android versions. More info - at the android developers portal

I don't obtain change color of AppCompat

I'm having the same problem, but I generate a theme via X and after add into my project and I did the correctly references in my styles.xml, however don't work.
My manifest.xml is this:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
Was generated the file below in http://jgilfelt.github.io/android-actionbarstylegenerator
styles_custom.xml, where add in my res/values/styles.xml:
<style name="AppBaseTheme" parent="Theme.AppCompat.Light"> </style>
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="actionBarItemBackground">#drawable/selectable_background_custom</item>
<item name="popupMenuStyle">#style/PopupMenu.custom</item>
<item name="dropDownListViewStyle">#style/DropDownListView.custom</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle.custom</item>
<item name="actionDropDownStyle">#style/DropDownNav.custom</item>
<item name="actionBarStyle">#style/ActionBar.Solid.custom</item>
<item name="actionModeBackground">#drawable/cab_background_top_custom</item>
<item name="actionModeSplitBackground">#drawable/cab_background_bottom_custom</item>
<item name="actionModeCloseButtonStyle">#style/ActionButton.CloseMode.custom</item>
</style>
And in res/value-v14/styles.xml
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
<item name="android:actionBarItemBackground">#drawable/selectable_background_custom</item>
<item name="android:popupMenuStyle">#style/PopupMenu.custom</item>
<item name="android:dropDownListViewStyle">#style/DropDownListView.custom</item>
<item name="android:actionBarTabStyle">#style/ActionBarTabStyle.custom</item>
<item name="android:actionDropDownStyle">#style/DropDownNav.custom</item>
<item name="android:actionBarStyle">#style/ActionBar.Solid.custom</item>
<item name="android:actionModeBackground">#drawable/cab_background_top_custom</item>
<item name="android:actionModeSplitBackground">#drawable/cab_background_bottom_custom</item>
<item name="android:actionModeCloseButtonStyle">#style/ActionButton.CloseMode.custom</item>
</style>
Well someone can help me, or give me the best directions, please?
Thanks
AppCompat is a library project. You need to reference the library project in your android project. So first you need dowload the library through SDK manager .
To download the Support Library through the SDK Manager:-
refer this link:- https://developer.android.com/tools/support-library/setup.html
In this above link read the topic :-Adding Libraries with resources ( It inlcudes so many steps that why I am giving the link )
After completing these steps :-
you can Add the library to your application project:
Step 1:- In the Project Explorer, right-click your project and select Properties.
Step2:- In the category panel on the left side of the dialog, select Android.
Step 3:- In the Library pane, click the Add button.
Step 4:- Select the library project and click OK. For example, the appcompat project should be listed as android-support-v7-appcompat.
Step 5:- In the properties window, click OK
note :-If your app is using the Support Library for compatibility on devices running versions lower than Android 3.0, your custom theme should use Theme.AppCompat theme (or one of its descendants) as your parent theme.

R Cannot be resolved to a variable.

I am trying to run an simple android project from a tutorial, However I am receiving the popular "R cannot be resolved to a variable" error. I have checked my gen folder and the R.id file is not there. This is the list of things I have tried so far:
have done a clean build several billion times.
fixed the project properties
There are no errors in my .xml files and they do not contain uppercase letters etc.
The package name in the source and manifest are exactly the same.
Have installed the latest SDK updates + restarted eclipse.
have deleted the gen file and done another clean build.
There is only an error in the source files, according to eclipse.
Here is a themes.xml file that may be causing a problem:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme"
parent="#android:style/Theme.Holo">
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="android:actionBarTabTextStyle">#style/MyActionBarTabText</item>
<item name="android:actionMenuTextColor">#+color/actionbar_text</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar"
parent="#android:style/Widget.Holo.ActionBar">
<item name="android:titleTextStyle">#style/MyActionBarTitleText</item>
</style>
<!-- ActionBar title text -->
<style name="MyActionBarTitleText"
parent="#android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#color/actionbar_text</item>
</style>
<!-- ActionBar tabs text styles -->
<style name="MyActionBarTabText"
parent="#android:style/Widget.Holo.ActionBar.TabText">
<item name="android:textColor">#color/actionbar_text</item>
</style>
</resources>
Apologies in advance if this sounds familiar, but I have tried everything I have seen from previous posts.
Happy to provide more details if needed. Thanks in advance.
Theme.Holo and Widget.Holo.ActionBar requires API Level 11
TextAppearance.Holo.Widget.ActionBar.Title and Widget.Holo.ActionBar.TabText requires API Level 13
Check your android:minSdkVersion. If it is less than 13 than you can't build your project(or you have to duplicate your styles for different API Levels, using different api level folders under res). eclipse shows this kind of errors.
And also your Android Project Build Target must be at least API Level 13.

Categories

Resources