An app to manage posts such as create, update, show the post list and detail also delete the post.
- Android Studio v4.1.1
- Kotlin v1.4.32
- Gradle v4.1.1
This project use Semantic Versioning 2.0.0 rules.
In build.gradle
(Module: app):
- Increase the versionCode
- Change the versionName
example:
Before
defaultConfig {
...
versionCode 1
versionName "1.0.0"
...
}
After:
defaultConfig {
...
versionCode 2
versionName "1.1.0"
...
}
The keystore is only need to create once and we will use it as long as its not expired. So, don't lose it. Keystore is used to build apps for google play store release
Follow this guide to create keystore.
For production you can use Android Studio IDE by going to Build > Generate Signed Bundle/APK... (then follow the instructions).
But here is for someone who love terminal:
For using terminal you need to define sign in config in your local.properties
, like this:
app.release.store.file=path/to/keystore/file
app.release.key.alias=release-key-alias
app.release.store.password=keystore-password
app.release.key.password=release-key-password
then go ahead:
- Flavor Production (.apk)
./gradlew assembleProductionRelease
- Flavor Production (.aab)
./gradlew bundleProductionRelease
This project apply Clean Architecture, MVVM and Repository Pattern (but in here we use Fuel Kotlin instead of Retrofit), and also SOLID Principle.
- Dependency Injection: Koin
- Navigation: Android Jetpack Navigation
- HTTP Client: Fuel Kotlin
- Database: Room
There are three flavors in this project, those are development, staging, and production. Each flavor has debug and release build type. Use debug type to debug the apps, release type will disable the apps from writing logs, apply proguard, and shrink resource.
Actually you can also do this using Android Studio IDE by going to Build -> Generate Signed Bundle/APK... (then follow the instructions and don't forget you need keystore for this).
But here is also for terminal lover:
- Flavor Development
./gradlew assembleDevelopment
- Flavor Staging
./gradlew assembleStaging
.
+-- app
| +-- presentation
| +-- util
+-- common
| +-- constant
| +-- extension
| +-- mapper
| +-- result
+-- core
| +-- <your_module_name>
| | +-- model
| | +-- repo
| | +-- source
| +-- <your_another_module_name>
| | +-- model
| | +-- repo
| | +-- source
+-- framework
| +-- core
| | +-- <your_module_name>
| | | +-- mapper
| | | +-- model
| | | +-- repo
| | | +-- source
| | +-- <your_another_module_name>
| | | +-- mapper
| | | +-- model
| | | +-- repo
| | | +-- source
| +-- http
| +-- database
.
There are four main modules those are app
, common
, core
, and framework
app
: Contains app UI, the app face it self, and also where user interact with the app, can't be implement to another module.app.presentation
: Contains activity, fragment, adapter, and viewmodel.app.util
: Contains util that help the UI, only define this util if it cannot be used for another main modules, or its for UI specific.
.common
: Like its name, common module means this module can be implement by all modules.common.constant
: contains constant such as date format, codes, etc.common.extension
: contains your kotlin extension.common.mapper
: contains mapper interface such as map response to model, model to entiry, etc.common.result
: contains function's return value wrapper and error model.
.core
: this is the shape of the app, contains app business process, and it is just interface.core.<your_module_name>
: define your module name, example:core.post
.core.<your_module_name>.model
: contains the data layer of clean archcore.<your_module_name>.repo
: contains the repository interfacecore.<your_module_name>.source
: contains interfaces of the datasource, such as api, database, or preferences.
.framework
: this module contains the implementation ofcore
module and another library integration such as database, http client, etc.framework.core
: contains implementation ofcore
moduleframework.core.<your_module_name>.mapper
: contains implementation of mapper used by this module, implement mapper interface fromcommon
module.framework.core.<your_module_name>.model
: contains response model, request model, and entity model ofyour_module
.framework.core.<your_module_name>.repo
: contains the repository implementation ofcore
module.framework.core.<your_module_name>.source
: contains the datasource implementation ofcore
module.framework.http
: contains http client interface and its implementationframework.database
contains database instance
All environment variable, base url, sensitive data, keystore credential, or something that has limited access need to define in local.properties
. Environment variable used in this project as below:
local.properties
:
app.release.store.file=path/to/keystore/file
app.release.key.alias=release-key-alias
app.release.store.password=keystore-password
app.release.key.password=release-key-password
field.dev.base.url=https://limitless-forest-49003.herokuapp.com
field.stg.base.url=https://limitless-forest-49003.herokuapp.com
field.pro.base.url=https://limitless-forest-49003.herokuapp.com