简体   繁体   中英

Gradle how to generate external library?

In gradle (in Android Studio) you can import external libraries simply by defining an url, eg:

dependencies {
    compile 'com.makeramen:roundedimageview:2.2.0'
    compile 'com.isseiaoki:simplecropview:1.0.10'
}

I know that you can link local libraries. But that's not wanted, since we want to share a common library in a team. I wonder how to setup such a URL for an own library? Is it also possible to make it not public accessible?

If you use a Private Git SCM like Github or Bitbucket , you can easily turn it as a Maven repository and host your private library there. This can be used to refer libraries as dependencies in your projects just like you do with public libraries hosted on MavenCentral, JCenter or others.

You can get the detailed description for the same here: Publish with Gradle on Bitbucket

Also you can refer this link to publish your library privately using JitPack. JitPack supports building and installing from private Git repositories. Build artifacts are also kept private and you can only download them if you have access to the Git repository itself.

You can also share your build artifacts (jar, aar) publicly while keeping the source code private. For example, you can easily distribute your library to your users without giving them access to code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM