Android associated source code support-v4, v7, v13 source code, support-v4v13

Source: Internet
Author: User

Android associated source code support-v4, v7, v13 source code, support-v4v13

In the actual development process of Android, you will often encounter the use of v4, v7 or v13 compatible packages, such as ViewPager, Fargment, but cannot be associated with the source code.

There are a lot of solutions on the Internet. Here we will only introduce a small series that have passed the test. I hope it will help you.

Procedure (here the android-support-v4.jar is used as an example, the v7 and v13 steps are the same ):

Step 1:

Right-click the android-support-v4.jar under the libs folder in the Android project and select Add Build Path in Build Path.



The purpose of doing so is to convert the private package of the android-support-v4.jar to the referenced package, because the system does not allow the private package to be associated with the source code, but can be associated with the source code for the referenced package.

Step 2:

Select the android-support-v4.jar package in Referenced Libraries, right-click ---> properties --> java Source Attachment ---> the path in Location path is the Source code path/extras/android/support/v4/src.



This associates the source code with the android-support-v4.jar package in the Referenced Libraries, and you will find that you still cannot view the class source code in v4 package through F3. This is because there is a android-support-v4.jar In the Android Private Libraries in the project. From the Order and Export in the Java Build Path tab of the project, you can find that the Order of Android Private Libraries is prior to the android-support-v4.jar, so when you view the class source code in the v4 package, the system first looks for the associated source code in Android Private Libraries, so it cannot be found.

Step 3:

Before Order and Export moves the android-support-v4.jar Order to Android Private Libraries.



In this way, you can access the source code of the class in the v4 package:





Android support v7 how to import source code note that v7 v4 does not work

File ---- Import ---- Existing Android Code Into Workspace.
Select <sdk>/extras/android/support/v7/appcompat /.

Search for platform_framework_support on github and download and decompress it.
Add the android-support-v7-appcompat.jar.properties file in the libs directory of your own appcompat project, the file content is src = Your path/platform_frameworks_support-master/v7/appcompat/src.
Close the v7 project and open it again.


 
Is it possible to use a higher version API in a lower version with a android-support-v4 added?

Support-v4 only provides some extended components and functions beyond the android api .... It's not used to run a lower version to access a later version of the api ····

Related Article

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.