Code sharing in Android Studio

后端 未结 4 1995
臣服心动
臣服心动 2021-01-18 07:53

I have started working on a project where I will need to share a bunch of Java classes across a bunch of apps. In Eclipse it was possible to create

4条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-18 08:21

    You can certainly create and use a library without making it open source or available to others.

    First, you don't need to make it an aar unless it contains Resources. If it's just plain classes, you can just make it a .jar file.

    Either way, the easiest way to share these libraries (either aar or jar) is to set up your own repository. Nexus and Artifactory are the two most common repository managers.

    You keep the library in its own project, and then publish it to your own, in-house repository.

    Then, projects that need to use the library are configured (in gradle) to use the in-house repository, and get the library from it.

提交回复
热议问题