Import third-party libraries in Android Studio

Source: Internet
Author: User

Previously developed android are used by Eclipse, recently due to the development of an application with foreign friend Timothy, he was just switching from WP platform using Android, using the development environment when Android Studio, in order to facilitate project communication, I was trying to use Android Studio. Just started with a question: How do I import a third-party library in Android studio?

First I use the studio version of 0.5.8, try to solve the following, in two ways:

1. Importing the JAR Package

Directly copy your jar package (such as Actiobarsherlock.jar) to the project's Libs directory, then right-click the jar file and select Add as Library...,ok.


2. Importing library Project (more hassle)

Try to follow the methods in Http://www.cnblogs.com/neozhu/p/3458759.html, not successful (too much to modify, too cumbersome), and then find such a method on StackOverflow:

The new Android library replaces files for

2.1 Select File->new module->android Library, click Next, fill in the app name (such as Notesshare) and Module name (such as the third-party library inscription I quoted), Same as your third-party library name);

2.2 Delete all files in the Src/main directory in the library directory;


2.3 Copy the Androidmainfest.xml, res, src files (clips) of the third-party library to the Src/main directory of the library directory;

2.4 Rename the SRC directory under the Src/main directory (SHIFT+F6) to Java;

2.5 Delete the dependencies and release modules in the library directory (inscription directory) under the Build.gradle file (note Do not modify the wrong place);

2.6 Add the template to your project: File->project Structure, you can see the left modules a column more than your project (Notesshare) outside of a module (inscription), click on your own engineering module, To switch to the Dependencies tab, click the "+" icon in the top right corner and three options appear (1. Library Dependency 2.File Dependency 3.Module denpendency), keyboard key 3 selection, then the Dependencies tab will show the Libraries module.


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.