Android Import V7 Package common error, as well as project reference V7 package error resolution, ANDROIDV7

Source: Internet
Author: User

Android Import V7 Package common error, as well as project reference V7 package error resolution, ANDROIDV7

Android under V4 V7 V21 Package is an extended support package for Android system, just like the Windows system patch for a reason.

Android's expansion packs are primarily designed to be compatible with the lower version, For example, after android3.0 appeared actionbar, if you want to use Actionbar, then the mobile phone system must be more than 3.0 to use, this will cause many users can not install the APK to lose the user; Package? I understand that, for example: if the native Actionbar is packaged directly into the lower version of the SDK package, but the lower version of the phone does not have the relevant code, so even in the development of a compatible version, but run on the low version of the phone, the application to the system to find Actionbar, Found that there will be an error, so this practice is not possible)

Google developers to the high version of the new things made a lot of backward compatible support package, this is V4, V7 ... such as the role of the package, the realization of the principle is to imitate the high version of the new content, using the lower version to achieve (such as V7 package in the Actionbar, in fact, is a custom title bar, and then the title, logo, back key and so on, Assigning values to these controls or setting properties is a property name that mimics the native Actionbar, please follow my next blog---replace native actionbar with Actionbarsherlock)

However, when I use the V7 package is not so smooth, here to summarize the use of the steps, errors encountered and solutions:

1. Import V7 Package:

Eclipse-->import--->existing Android Code into workspase--->

D:\IDE\ANDROID64\sdk\extras\android\support\v7\appcompat; (after successful import, there will be a project in the workspace, open to look inside the content, found that the SRC directory is empty, why no code?) The original V7 package Java source code into a jar package, in the Project Libs directory The structure of the whole project is to refer to the V7-appcompat.jar, then a res directory, in fact, this res directory is the focus, if there is no res directory, the use of V7 package will not be so troublesome, directly copy the V7-appcompat.jar into the project on the line, but there is no resources in this jar package Directory, which is why the V7 support package requires a library engineering form for developers to use. )

2, Next will find V7 Engineering reported the error:

Res directory has a lot of values directory, this is Android in order to compatible and adapt to different versions of the system and the breakdown of a number of values directory,

VALUES-V21 is the Android5.0 system loaded resource directory (according to the suffix after the values, can distinguish between different versions, different resolutions, different languages and so compatible with different versions, adapt to different screen sizes and different national languages), some people will try to put these "superfluous" The values package deleted, will not error, but found that after the deletion of the new error, never-ending, and even if you delete all the errors, it is estimated that the V7 package is useless, so this solution is not feasible.

Just said that VALUES-V21 is the directory of Android5.0 load resources, but I found that my build version is 4.0, which is why the error, because the compilation version is 4.0, when the application compiled to hit the installation package, she does not think that the application will be installed on 5.0, because target is 4.0, so it will not be 5 .0 do anything, also will not pack in values-21, since will not pack in, there is no value, so think Android4.0 application should not exist in this values-21, so the error; The solution is to say that the build version increases to more than 5.0:

Workaround: Just increase the build to 5.0.

(Right-click-->properties--->project Build Target---> Tick 5.0 ——— >clean Library project)

3, our Engineering Application Library project, or error, the same reason, because our project will V7 Library project quoted in, I do your resources directory contains the V7 resources directory, there will be values-v21, etc. I've also got to increase our engineering build to 5.0, then clean

4, the completion of the above operation, found that the project is not wrong, but a run, and error:

It says that there are multiple Dex files in the Actionbar of the SUPPORT-V7 package, but this error is usually caused by the repeated introduction of the jar package;

Then look at the project build path:

It turns out that two V4 and V7 packets were introduced, which is why?

Originally in our own project Libs has a V4 bag and a V7 package, and V7 Library project inside also, my project also quoted V7 Library project,

This introduces the V4 and V7 packages under the V7 Library project, so the project is repeated:

Find the reason, the problem is solved, open the project build Path,remove off our project two support packages on the line

(using the support packages introduced in the V7 Library project):

Run the project.

Android Import V7 Package common error, as well as project reference V7 package error resolution, ANDROIDV7

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.