Android的工作室1.0.1添加外部库 [英] Android Studio 1.0.1 add external libraries

查看:296
本文介绍了Android的工作室1.0.1添加外部库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚才下载的Andr​​oid 1.0.1工作室,这是新的项目结构

I have just downloaded Android Studio 1.0.1 and this is the new project structure

,当我看到它在资源管理器中有一个空的libs文件夹

and when i see it in the explorer there is a empty libs folder

我要导入3外部库我有,我想使用。

i want to import 3 external libraries i have, which i want to use.

build.gradle已经定义了这个

build.gradle has already defined this

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}

但是当我复制我的图书馆libs文件夹我的项目仍然不承认它, 我如何使用libs文件夹,并复制我的图书馆在此文件夹中,并使用它? 任何帮助吗?

but when i copy my libraries in libs folder my project still dont recognize it, how do i make use of the libs folder and copy my libraries in this folders and use it? any help?

编辑: 这是一个简单的问题,如何添加库在Android的工作室项目 像我们一样在月蚀,比如我有一个库项目(一个文件夹,而不是一个罐子!)。 在我的情况,我有一个库项目viewPagerIndicator(又一个库文件夹,而不是一个罐子!)我必须将它添加到我的项目像我使用的Eclipse做到这一点通过导入项目中,右键点击 - >属性 - >安卓 - >库 - >添加 - >选择库项目

it was a simple question, how to add libraries to project in Android Studio like we do in eclipse, for eg i have a library project(a folder, not a jar!). in my case i have a library project 'viewPagerIndicator' (again a Library folder, not a jar!) i have to add it to my project like i use to do it with eclipse by importing project, right click->properties->android->Library->add-> select the library project

PS:我已经找到答案了。 假设我的图书馆项目名称为viewPagerIndicator - 在我的Andr​​oid Studio项目的根目录复制库项目 - 在build.gradle(在你的Andr​​oid Studio项目文件夹)写这篇文章下的依赖       编制项目(:viewPagerIndicator) - 包括在settings.gradle,写:       包括:viewPagerIndicator - 同步项目摇篮文件

PS: i have found the answer now. suppose my library project name is 'viewPagerIndicator' - Copy library project on root of my Android Studio Project - Under build.gradle(under your Android Studio Project folder) write this under dependencies compile project(':viewPagerIndicator') - include it in settings.gradle, write: include ':viewPagerIndicator' - Sync project with gradle files

这是怎样的项目结构看起来像现在:

this is how project structure look like now:

非常难过,管理员停止的问题而不去理解它。

so sorry that admins stopping the question without understanding it.

推荐答案

首先,你必须在Android的Studio中添加库项目(模块)

First you have to add library project (module) in Android Studio

File -> Import Module

要在构建路径中添加库项目(模块),点击

To add library project (module) in build path, click

File -> Project Structure

在左侧点击

app -> Dependencies tab -> green + button -> Module dependency

现在选择您已经添加了库项目。

Now select the library project you already added.

有关更多详情,请参阅此链接

For more details refer this link

这篇关于Android的工作室1.0.1添加外部库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆