Android Project Combat (33): acquisition of dependent three-party jar file, AAR to jar

Source: Internet
Author: User

Original: Android Project Combat (33): As under get get dependent on the three-party jar file, AAR to jar

Using the Android Studio development project, there are several ways to reference the three-party code: Jar package, class library, Gradle.build compile dependency.

You'll find that many of the projects on GitHub offer only compile dependencies, but what happens when a jar package is used and the project does not provide a jar package?

In fact, Android Studio in the compile way relies on the three-party project has already had the project's jar package, we only need to go to the local to find the jar package.

Find Method:

One, the project outline path: External Libraries, will find a lot of our current projects in use of the three parties.

Second, select one of the right: Select the Library Properties ...

Third, you can see the three-party project's jar package in the local path location, only need to find the jar package in this path can be

The jar file can be found under this path.

V. Resource.jar and Jars

In practice, we will find that there are three sides we can find its resource.jar and jar two jar package, and some three we can only find Resource.jar package without jar package

Resource.jar file and. jar File differences:

In fact, the Resource.jar package is called the Resource jar package, and we unzip it to find that the files are. java type. and extracting the. jar file will find the files in the. class type.

Only the jar package inside the. class file is what we can really use, and the Resouce.jar resource jar package is not available, otherwise it will report an classnotfindexception exception.

So how to get the jar package if the three parties found in the above steps only have Resource.jar packages.

Here's a look at the differences between. aar files and. jar files.

*. Jar: Contains only class files and manifest files, does not contain resource files, slices, etc. in all res files. *. AAR: Contains all resources, class, and res resource files are all included if you are just a simple class library then use the generated *.jar file; If you are a UI library, Contains some resource files, such as control layout files and fonts, you can only use the *.aar file.

According to the above---four steps, we will actually find

 

In addition to the. jar file and the. resource.jar file, there is a. aar file

If you have a. aar file, you can obtain the. jar file we need from the. aar file

The steps are as follows:

1. Find an. aar file

2, modify the file format for. zip about unzip

3. Unzip the. zip file

4. The Classes.jar is the three-party we need. The jar package is renamed to the name you want.

Android Project Combat (33): acquisition of dependent three-party jar file, AAR to jar

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.