Is it possible to reuse a base project for other projects?

0

I'm developing three similar projects, where basically the behavior of the screens and layouts will be the same. What will change from one to another are texts, background images, icons. How could I reuse a project without having to start over with each new project? I do not know if renaming the project and changing the items one by one would be the most effective way to do this.

    
asked by anonymous 24.04.2017 / 16:32

3 answers

1

The legal in this context to reuse your project is not to use an IDE, but to use git and work with fork , because that way you write a base project and on top of this, you only make changes to child projects.

Another option is to put the base code in a base branch is to work the differences in a child branch of this branch, making only a merge of the changes made in the base and also the peculiarities would remain in the children.

To learn more about using git, you can use the following link: link

    
24.04.2017 / 16:41
1

There are many ways to reuse code. You will have to decide the best way, depending on some factors. The primary, in my opinion, is the relationship between applications.

a. In the way you describe, apps are related, so you can just keep a code base and use the compilation variation . Build types and flavors allow a code to have multiple "incarnations" and make maintenance easier.

b. Now if the products have a similar code base, but are completely distinct designs, you can copy and rename them, but you will need to make some hand changes such as package name and other references. It is not the most effective way.

Using Android Studio, I usually create the new project normally, I open the project that has the codes I want and copy and paste only the necessary files. AS renames packages and reports other errors.

c. You can also use the GIT to create derivative projects (forks) of the original. You still need to pay attention to the package name, but it also works.

    
24.04.2017 / 19:11
0

You can use Gradle's Multi Project concept and modularize the project in Android Studio where each module or subproject would be a different app (basically other folders besides the main app folder that would have their own classes and resource files ). The advantage of this is that you could import classes from any module into another, including entire Activities without having to rewrite or duplicate code. All you have to do is create the dependencies between the modules in Gradle (more specifically in the app build.grad) and make the desired "imports" in the code.

Take a look at this course: link

    
24.04.2017 / 19:41