android studio中导入xUtils和xUtils3开源库

来源:互联网 发布:vb picturebox 清空 编辑:程序博客网 时间:2024/05/23 01:24

前题:xUtils和xUtils3是不一样的,xUtils3是xUtils的升级版,下面是分别导入的方法

导入xUtils

在github上下载下来xUtils,发现那个library不能被android studio识别为库文件,不能直接用import Module方法导入,因为少了build.gradle文件吧。所以我直接将下载下文件中的的xUtils-2.6.14.jar 这个jar包复制到对应Module的libs库中,然后右键Add As library即可

1

1

导入xUtils3开源库

1

1. 将xUtils的build.gradle文件中的版本号改成你自己项目的

1

2. 项目会出现如下图所示错误

2

3. 将下面两句内容加添加到Project中的build.gradle中的dependencies中

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

3

思路:可以先将xUtils做为一个android项目在android studio中打开,查看这个项目的build.gradle文件,然后按着修改自己项目的build文件即可。期间xUtils3Sample的build.gradle可能会报错,下面的代码中的compile后面的版本注意一下,不要弄错。

dependencies {    compile fileTree(include: ['*.jar'], dir: 'libs')    compile 'com.android.support:appcompat-v7:23.0.1'    compile 'com.android.support:support-v4:23.0.1'    compile 'com.android.support:recyclerview-v7:23.0.1'    compile 'com.android.support:design:23.0.1'    compile project(':xutils')}
3 1
原创粉丝点击