简体   繁体   中英

Android support library appcompat v7: cannot find actionModeShareDrawable resource

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.

用鼠标右键单击v7 appcompat库项目 - >属性 - > Android - >确保选择Android 5.0作为项目构建目标。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM