Android Application bootstrap sample using Kotlin.
Sample application with:
- Kotlin and kapt (annotation processing) configuration
- Fabric configuration (Crashlytics)
- Basic Dagger2 DI structure implementation
- Sample Retrofit API definition
- Moshi and Moshi-JsonApi configuration
- Sample Identification service (generating persistent UUID for every install)
- Sample tests using kotlintest
- And few other useful dependencies:
There are few steps should be done before running this project
git clone https://github.com/lostintime/android-starter.git
While importing file from gradle file - Android Studio will create
a required local.properties file in project root folder.
It will contain something like this:
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Sun Nov 20 09:38:17 EET 2016
ndk.dir=~/android-sdk-macosx/ndk-bundle
sdk.dir=~/android-sdk-macosx
More details about signing android apps you can find in Sign Your App android studio documentation section, here I'll list commands to be executed (in project root folder):
Generate Debug Signing (replace passwords and key alias with yours):
keytool -genkey -v -keystore ./certificates/starter-debug-key.keystore \
-storepass <store password here> \
-keypass <key password here> \
-alias <key alias, ex: starter_debug_key> \
-keyalg RSA -keysize 2048 -validity 10000
You should fill al certificate fields, ex:
What is your first and last name?
[Unknown]: Lostintime
What is the name of your organizational unit?
[Unknown]: IT
What is the name of your organization?
[Unknown]: NA
What is the name of your City or Locality?
[Unknown]: Chisinau
What is the name of your State or Province?
[Unknown]: Chisinau
What is the two-letter country code for this unit?
[Unknown]: MD
Is CN=Lostintime, OU=IT, O=NA, L=Chisinau, ST=Chisinau, C=MD correct?
[no]: yes
Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 10,000 days
for: CN=Lostintime, OU=IT, O=NA, L=Chisinau, ST=Chisinau, C=MD
[Storing ./certificates/starter-debug-key.keystore]
Then do the same for release signing:
keytool -genkey -v -keystore ./certificates/starter-release-key.keystore \
-storepass <store password here> \
-keypass <key password here> \
-alias <key alias, ex: starter_release_key> \
-keyalg RSA -keysize 2048 -validity 10000
... and details:
What is your first and last name?
[Unknown]: Lostintime
What is the name of your organizational unit?
[Unknown]: IT
What is the name of your organization?
[Unknown]: NA
What is the name of your City or Locality?
[Unknown]: Chisinau
What is the name of your State or Province?
[Unknown]: Chisinau
What is the two-letter country code for this unit?
[Unknown]: MD
Is CN=Lostintime, OU=IT, O=NA, L=Chisinau, ST=Chisinau, C=MD correct?
[no]: yes
Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 10,000 days
for: CN=Lostintime, OU=IT, O=NA, L=Chisinau, ST=Chisinau, C=MD
[Storing ./certificates/starter-release-key.keystore]
Make a copy of keystore.sample.properties at keystore.properties and
update fields with values you provided on previous step, while generating certificates
Never commit your certificates and credentials (./keystore.properties and ./certificates/*.keystore)!
In order to use Crashlytics and Beta for app distribution - Signup first for an Fabric account: https://fabric.io/sign_up
Make a copy of app/fabric.sample.properties at app/fabric.properties
Then on your settings page - select organization
you want to add your app to and from page header - get API Key and Build secret and
update config values in app/fabric.properties.
To build the app and install to attached device run: ./gradlew installPreviewDebug.
By default Crashlytics is enable only for release configuration,
so Fabric app will be registered only when you run release build first time.
Now we're ready to do our custom changes. Start with renaming
base package (from com.example.starter).