android studio 使用以及常出现的问题
来源:互联网 发布:python自动化ios开发 编辑:程序博客网 时间:2024/05/02 02:46
http://www.android-studio.org/index.php/docs/guide/132-androidstudio-inport-jar
Android Studio
ANDROID STUDIO 最新资料
ANDROID STUDIO 热门资料
Android Studio 使用指南(汉化)
如何引入第三方jar包(以google play service为例)
- 最后更新于 2013年11月08日
- 点击数:18607
原文地址:http://forum.xda-developers.com/showthread.php?t=2421186
翻译:Android Studio 中文组(大锤译)
在Android Studio(AS)的开发中,遇到引入外部类库或第三方jar包的情况,确实是件很恼人的事情。因为AS是基于Gradle构建,所以和传统的导入方式有些不一样。
笔者也曾为此头疼过好一阵,现在终于有了解决办法,拿出来和大家分享一下。
这里以导入Google Services library为例,具体操作步骤如下。
1. 打开你的buid.gradle文件。应该用哪一个呢?Project中的,还是Module中的?(如图所示,Module中的)
2 . 将google-play-services.jar这个jar包拷到指定的位置。原来可能是在这个目录下:$ANDROID-SDK/extras/google/google_play_services/libproject/google-play-services_lib/libs ,比如现在我把它放到了$GOOGLE_PLAY_LIB目录下。
3 . 如果你已经有了别的dependencies(如Android Studio Library),我们把它加到list当中去,也就是将你需要编译的部分,从dependencies中移到list里。
例如先前长这样:
List myDependencies = ["com.android.support:appcompat-v7:18.0.+"]dependencies { //moved into List above, so there'll be nothing here.}
4. 加入Google Play Library之后:
List myDependencies = ["com.android.support:appcompat-v7:18.0.+", fileTree (dir: '$GOOGLE_PLAY_LIB', includes: ['*.jar'])]
PS:不要忘了把$GOOGLE_PLAY_LIB 改成你本地的目录,如 E://Android/Development/Lib
5. 修改dependencies里面的内容:
List myDependencies = ["com.android.support:appcompat-v7:18.0.+", fileTree (dir: 'E://Android/Development/Lib', includes: ['*.jar'])]dependencies { compile myDependencies}
6. 然后就是耐心等待项目compile和make了。^_^
笔者成功的测试过Google Android Map v2,如果你有遇到问题,欢迎留言。
=======以下是另一个网友留言,有更简便一些,不过得注意路径的问题========
只需要从SDK中下载 Google Repository & Google Play Services,然后在build.gradle文件中申明,如下所示:
dependencies {compile('com.android.support:appcompat-v7:18.0.+')compile('com.android.support:support-v4:13.0.0')compile ('com.google.android.gms:play-services:3.2.25')}
再或者,直接:compile files('libs/google-play-services.jar')
- android studio 使用以及常出现的问题
- android studio 升级常遇到的问题以及解决方法
- android studio使用出现的问题
- android studio使用出现的问题汇总
- Android Studio使用shape出现的问题
- 使用Android studio 出现的一些问题
- Android studio使用中出现的问题
- Android Studio使用时出现的问题
- android studio常使用的插件
- 导入Eclipse工程 到 Android Studio以及出现的问题
- VS2010 OPENGL配置以及常出现的问题
- android studio NDK使用教材以及出现
- Android Studio 使用过程中出现的问题及解决办法
- Android studio使用androidannotations所出现的问题
- Android studio使用androidannotations所出现的问题(2)
- Android Studio 开发常遇到的SDK版本的问题
- eclipse转android studio常遇到的问题
- Android Studio 安装以及使用中遇到的问题
- Class文件格式总结
- Cookies的知识点汇总
- 命令或可执行程序
- 发布3633快速接单软件V1.2
- php异常处理—异常的基本用法
- android studio 使用以及常出现的问题
- 为GCD队列绑定NSObject类型上下文数据-利用__bridge_retained(transfer)转移内存管理权
- 南京大学<软件测试>笔记
- [leetcode][贪心] Gas Station
- JSP&Servlet
- 悬浮窗onTouch和onCLick的冲突
- Javascript异步编程的4种方法
- SpringMVC实现RESTful风格
- 大数据