Android Studio 1.1 uses introduction and import of jar packages and third-party dependent libraries

Source: Internet
Author: User

Importing JAR Packages

The way to import a jar package is simply to put the jar package you need to import into the Libs in your project, then right-click your jar file and select "Add as a library" to use the jar package in your project. If the Libs directory has been copied to the project, if it is not found in Android Studio, you should switch to project files view, and then you will find all the files and folders. Right click to select Jar, click "Add as a library", complete!


dependencies {
Compile Filetree (dir: ' Libs ', include: [' *.jar '])
Compile files (' Libs/gson-2.2.4.jar ')
Compile files (' Libs/universal-image-loader-1.9.2.jar ')
}

Add a remote open Source Library

You can edit the Build.gradle file without downloading the Open source Library, entering your project (typically the app directory). Add dependencies in dependencies. As shown below

dependencies {    compile ‘com.github.eluleci:flatui:3.0.0‘}
Add a local Open Source library

Download the open Source Library, place it in the same directory as the app directory, then edit the Setting.gradle file and add: ": Open Source Library folder name". For example, I placed the Image-loader Open Source Library folder in the app's sibling directory, and then edited the Setting.gradle and changed the contents to:

Include ': App ', ': Image-loader '

Then go back to the Build.gradle file in your app directory and add it under the dependencies {} node:

Compile project (': Image-loader ')

After that, you'll be able to reference the open source repository in your code (actually called Module).

Android Studio 1.1 uses introduction and import of jar packages and third-party dependent libraries

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.