如何创建我自己的android库并托管它 [英] How to create my own android library and host it

查看:29
本文介绍了如何创建我自己的android库并托管它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个登录屏幕,用于多个不同的 Android 应用程序.打包它以便其他人可以在他们的应用程序上使用我的登录功能的最佳方式是什么.如果我们要进行更改,最好为他们自动同步.***编辑****似乎将其打包到库模块中是最好的选择.例如,如何上传此模块,以便如果我们对此模块进行更新,它将无缝更新,而无需从 github 中提取.

I'm working on creating a log-in screen to be used with multiple different android applications. What would be the best way to package it so that other people could use my log-in function on their apps. It would be preferred that it would auto-sync for them in-case we were to make changes. ***EDIT**** It seems packaging it into a library module is the best option. How does one go about uploading this module so that if we make an update to this module it will seamlessly update without having to pull from github for example.

谢谢!

推荐答案

如果您已将代码推送到 GitHub,那么使用 JitPack.

If you've pushed your code to GitHub then sharing the library (aar) is easy with JitPack.

您的用户只需要将存储库添加到他们的 build.gradle 中:

Your users will just need to add the repository to their build.gradle:

repositories {
    jcenter()
    maven { url "https://jitpack.io" }
}

然后将您的 GitHub 存储库作为依赖项:

and then your GitHub repository as dependency:

dependencies {
    // ...
    compile 'com.github.YourUsername:Repo:Release'
}

好消息是您不必上传您的库.在幕后,JitPack 将检查来自 GitHub 的代码并编译它.当您在 GitHub 上发布新版本时,其他人可以使用它.

The nice thing is that you don't have to upload your library. Behind the scenes JitPack will check out the code from GitHub and compile it. As you publish a new release on GitHub it becomes available for others to use.

还有指南关于如何准备一个安卓项目.

There is also a guide on how to prepare an Android project.

这篇关于如何创建我自己的android库并托管它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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