The introduction
I don’t know if you have used Spring Initializr, this is the famous Spring Boot online generation tool, a perfect ecology, to provide developers with too much convenience, quietly pay, but why there is no Android project online generation tool? I don’t think so. Jetpack provides a set of components for Android application development, which is very convenient, and the architecture-component-samples app is officially open source, which has a large number of template projects. There are many authors who have also done open source for MVVM, and I myself have done MVP open source projects based on actual development experience. Well-known MVVM:
- MVVM-Architecture
- Jetpack-MVVM-Best-Practice
- MVVMHabit and so on, but for these projects, do you have a kind of confusion, if we use their summarized experience to develop new projects, do we have to modify the package name, add some favorite framework dependencies and so on, but how to do it? That’s what I’m going to do next, build an online Android project generation tool
Jetpack online generation tool
Why is it called the Jetpack builder? Why? That’s not the point, the point is what we’re going to do, look at the design, actually the implementation, because it’s already deployed, please click on the title to see
- Custom package name
- Customize the project name
- Choose a development language
- Select the framework you want to integrate with. The integration framework is divided into default dependencies. Add base dependencies to build.gradle.
- MVVM architecture template selection, later integration of more MVVM templates to provide customized projects is not a bit interesting now, but how to implement these functions? So let me talk about my implementation
implementation
I choose to implement flutter, because the convenience of Flutter has made me love it. A set of code runs android, ios and Web, which is very good service. I choose NodeJS, because NodeJS is the best tool for making this kind of small tool, which is easy to develop and stable to run.
Flutter implementation
It has been open source to Github and the whole code of my website is here ibaozi please see the code implementation in the figure
Nodejs implementation
To share with you the experience is actually the biggest difficulty is, package name replacement, keyword replacement, online search a lot, find the following several special hot, you can choose one of the implementation of yeoman.io/ github.com/wycats/hand… Reference items: github.com/dekzitfz/ge… The most critical code implementation
this.fs.copyTpl(
this.templatePath('settings.gradle'),
this.destinationPath(rootDir + '/settings.gradle'),
{app_name: this.answers.name.replace(/\s/g, ' ')});Copy the code
The project uses this code to copy the template code, replace the app_name defined inside, and paste the replacement code into another path.
todo
More template code will be added in the future for your benefit. Also welcome to want to cooperate with me, we talk about the cooperation model.
Service deployment, the first version of beta will be with you soon, blink and refresh the site to try 😄