Various issues encountered when using support V7 for Android projects

Source: Internet
Author: User

When we develop an Android app that needs to use the Android-support-v7-appcompat.jar library (for example, to use Actionbar and fragment on version 2.2), after importing the two libraries of V4 and V7 in a project, novices often encounter some problems. Here, summarize the problems you may encounter and how to resolve them.

Tools/Materials
    • Two libraries required: Android-support-v4.jar,android-support-v7-appcompat.jar

    • Warm tip: The best version of the two libraries, or there may be some other problems arise.

    • These two libraries can be obtained from the Sdk\extras\android\support in the SDK

Method/Step
  1. The first is to import the two libraries in the project

    You can create a libs file at the root of the project and then copy the two libraries into it, and Eclipse refreshes the project, and Eclipse intelligently adds the two libraries

  2. example:

    res\values\styles.xml:4: Error:error Retrieving parent for item:no Resource found that matches the given name ' Theme.ap PCompat.Light.DarkActionBar '.

    workaround:

    Add the resource library, for the above example, AppCompat this is v7, so the lack of v7 resources. From the SDK, the path is Sdk\extras\android\support\v7\appcompat, and the library is imported via Eclipse (import). Then add the Lib before the project, and then clean down. So the above problem can be done.

  3. Two types of questions: Values-v11,values-v21,values-v17 and so on no resource found

    Say:

    Appcompat\res\values-v21\styles_base.xml:75:error:error Retrieving parent for item:no Resource found that matches the G Iven name ' Android:Widget.Material.ActionButton '.

    Appcompat\res\values-v11\themes_base.xml:178:error:error:no resource found that matches the given Name:attr ' android:w Indowactionbar '.

    Appcompat\res\values-v14\themes_base.xml:27:error:error:no resource found that matches the given Name:attr ' Android:ac Tionmodepastedrawable '.

    For the same reason that resources are not found under the values that are loaded for different Android targets in Values-v11, the resource under this target cannot be found.

    Workaround:

    It's easy to change the target=android-8 in project.properties to target=android-21 or higher (provided the SDK has downloaded the target library), and then clean the project. This kind of problem also solves, of course you in manifest don't forget to add uses-sdk, to allow the minimum version.

  4. 4

    Finally attached test write Actionbar tab plus fragment, on Android2.3.4 Samsung phone implementation Results


Various issues encountered when using support V7 for Android projects

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.