![what is android studio module what is android studio module](https://i.ytimg.com/vi/P2OfVxD7xxg/maxresdefault.jpg)
If you frequently make changes to that library, you’re going to want it to be versioned, and you probably want to have the library in a repository that’s separate from your app so that you can checkout the library and reuse it for any app that needs it. First off, you have to have copies of a library for every app that depends on it. It doesn’t take make to see the unfortunate features of this setup.
#What is android studio module code
The project directories for App1 and App2 would each contain a submodule that has the code from the StickyListHeaders library that each app needs to build successfully. If you were to follow the Google’s user guide in setting up your projects, then you would create two projects, one for App1 and another for App2. Suppose you’ve got a project structure that looks something like this:Īpp1 depends on the StickyListHeaders libraryĪpp2 depends on the StickyListHeaders library
![what is android studio module what is android studio module](https://i.stack.imgur.com/TN2B7.png)
![what is android studio module what is android studio module](https://i.stack.imgur.com/QVkrS.jpg)
If, on the other hand, you are working on several apps that depend on the same libraries, read on. If you only ever work on one app and you know for sure you wont have multiple apps that depend on the same library, feel free to skip the rest of this post and continue blissfully using the simple configuration for multiple projects in Android Studio. Some Unfortunate Features of “The Google Way”īoth of the unfortunate features of the “Google way” of handling multi-project setups only arise if your working on several apps that depend on the same libraries. I discuss those reasons in the next section. In spite of it’s simplicity, there are several reasons why we might want to avoid this configuration. Our adle file looks like this:Īs you can see, Google’s suggested configuration is simple, and its even simpler if you use the Android Studio UI to configure you gradle files for you. When the library modules are within the project directory, telling gradle to build them is easy. This picture illustrates how Google suggests we handle multi-project setups: our main “app” module is supposed to depend on library modules that reside within the project directory. In this post, I will briefly explain Google’s recommended configuration, note its shortcomings, and recommend a different way to configure your gradle files to support multi-project setups in Android Studio. Google’s Gradle Plugin user guide recommends a method for configuring your gradle files to build multiple projects.
#What is android studio module for android
An Alternative Multiproject Setup for Android Studio