Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Large Scale Project - Is it ok to divide in to several library projects?

Im going to develop a very large scale android project, which has thousands of classes and resources. Im planning to separate application in to modules and develop them separately as library projects. Later combine them together. (Application may contain 5 - 6 modules, so planning to create 5 - 6 library projects and combine them)

Is this approach ok? or android experts, please suggest a way to maintain and develop such a big project?


Edit:

Libraries hold shared code for multiple applications -> Yes agreed 100% true

But this project is like combination of several projects. Its like this:

Home Screen Dashboard has 8 buttons which represents 8 modules you click on one button - > it opens up an activity and it has its own thousands of fragments, layouts, drawables etc, which is independent from other modules

so likewise i have non interdependent use cases which can be separated easily, and 4 - 5 developers are going to be involved this project, so if I can separate in to several library projects, i can simply allocate developers easily based on modules(library projects)

So one approach is to create one project and create package structure by modules com.name.something.Module1

under this package i have

com.name.something.Module1.activity
com.name.something.Module1.util
com.name.something.Module1.widget
com.name.something.Module1.data
com.name.something.Module1.dao

and module 2

com.name.something.Module2

com.name.something.Module2.activity
com.name.something.Module2.util
com.name.something.Module2.widget

etc.

so this is first approach but each module has thousands of classes and resources, layout xml files etc.

The other approach is to separate modules as library projects. I dont know how large scale projects maintain their codebase, like facebook, twitter etc.

Please advise.

like image 827
Yasitha Waduge Avatar asked Nov 04 '22 20:11

Yasitha Waduge


2 Answers

Libraries hold shared code for multiple applications... if you are entirely focused on a single application then there's no point in separating your code into 5-6 library projects.

One common way Android developers separate their project is by making sub-packages for different components. For example, custom Views and adapter's go in com.package.name.ui, utility packages go in com.package.name.util, etc. Other than that, you just have to be smart... starting an app from scratch that will have "thousands of classes" sounds pretty ambitious and there is not really any single piece of advice that will make your life easy.

like image 152
Alex Lockwood Avatar answered Nov 11 '22 11:11

Alex Lockwood


Is each module separated from each other or do they share data (e.g. the same database)? If they are separated I would suggest to create 8 separate apps, which would reduce the memory footprint of your app and would improve launch time.

If some, or all are using the same database, you might be able to create a database on the SD-card and use it from each separate app.

like image 36
banzai86 Avatar answered Nov 11 '22 11:11

banzai86