本章将告诉你如何创建自己的第三方库

创建库
准备:
1. github账号
2. Android Studio
3. git版本控制工具
一,打开AndroidStudio,File->New->New Project

打开AndroidStudio
二,创建Library

创建Library

AndroidLibrary
三,添加类,然后写一个加法的工具类

添加工具类

工具类
四,进行Git配置

进行Git配置
五,GitHub配置

GitHub配置
六,创建git仓库(这时候文件会变成红色因为文件未被提交)

创建git仓库

选择project
七,将文件加入到仓库(一般选择完会弹出这个对话框选yes),然后右键Git->add(最好在project视图下右键项目根目录)


八,上传到GitHub

上传

设置库名称

提交
九,推送到GitHub(其实在上一步完毕后它会自动推送上去的)推送过程中可能会让你登录账号

推送

十,登录GitHub查看

登录GitHub查看
十一,设置你的项目版本号

1514945644606_13.png

设置版本号
十二,打开https://jitpack.io/在里面登录GitHub账号

https://jitpack.io/
十三,点击自己的项目

找到自己的项目

将下面的代码添加到自己的项目中去

十四,集成自己的第三方库
首先在项目根gradle(不是module的gradle文件)文件里添加

然后在Module的gradle文件里添加依赖

接下来尝试自己的库的方法
