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
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
-
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.
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
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