Android studio是一个非常强大的android程序开发软件。今天就说一下怎样通过AndroidStudio把开源库library项目导入到AndroidStudio的Module中。

1、当然是将library先引入项目中了

New— —Import Module,然后找到library导入项目中来。

2、把Library项目添加到源项目中

打开源项目的build.gradle文件在dependencies 里面添加 compile project(‘:此处填写你想添加的library名称’)。

dependencies {    compile fileTree(include: ['*.jar'], dir: 'libs')    testCompile 'junit:junit:4.12'    compile project(':此处填写添加的library')}

这时build—clean project如果library没有报错,那么恭喜你library导入成功。如果有错误请继续往下看。

3、 Plugin with id ‘com.github.dcendents.android-maven’ not found.问题解决

现在我们打开library的build.gradle文件:

这时我们可以打开下载的原项目下的build.gradle文件


复制这两句代码

classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'

将这两句代码加入项目中的dependencies中,如下图:

4、修改library报错

现在我们打开library的build.gradle文件,查看dependencies :

这时我们可以打开下载的原项目下的build.gradle文件

根据原项目的build.gradle文件替换为如下内容:

dependencies {    compile fileTree(include: ['*.jar'], dir: 'libs')    testCompile 'junit:junit:4.12'    compile 'com.android.support:appcompat-v7:23.3.0'    compile 'com.android.support:recyclerview-v7:23.2.1'    compile 'com.android.support:support-v4:23.1.1'    compile 'com.android.support:design:23.2.1'    compile 'com.android.support:percent:23.2.1'    compile 'com.github.bumptech.glide:glide:3.7.0'    compile 'konifar:fab-transformation:1.0.0'    compile 'com.github.chrisbanes.photoview:library:1.2.4'}

这时再build—clean project,如果还有compile ‘konifar:fab-transformation:1.0.0’报错,应该是版本不对,打开Project Structure窗口搜索相应的版本的包添加即可,注意要删除版本不对的包。

更多相关文章

  1. Android日记之2012\01\01
  2. Android截屏事件监听
  3. android串口的使用
  4. Android(安卓)assets 目录介绍和应用
  5. Android布局整合include界面控件
  6. Android周报第三期
  7. android studio项目加载超时 找不到包等解决办法
  8. Android(安卓)ionic工程中调用webrtc获取视频流
  9. mac下编译ffmpeg1.1.4

随机推荐

  1. ASP.NET Core项目配置教程(6)_实用技巧
  2. ASP.NET Core中间件设置教程(7)_实用技巧
  3. ASP.NET MVC中传参并绑定数据的实例教程
  4. ASP.NET Core异常和错误处理(8)_实用技巧
  5. Asp.net MVC 对用户输入的字符串做Trim处
  6. ASP.NET Core使用教程(9)_实用技巧
  7. C#中DateTime与时间戳转换的实例代码
  8. Asp.net MVC 对输入的字符串字段做Trim处
  9. C#中自定义控件如何实现TextBox禁止粘贴
  10. 理解Asp.Net中WebForm的生命周期_实用技