Skip to content

fs/android-base

Repository files navigation

Android app skeleton

Build Status Build Status codecov

This project will help you quickly start developing a new android app

Table of Contents

  1. Setup. Install IDE, secret environment
  2. Build. Create apk
  3. How to Deploy
  4. Run tests
  5. ProGuard
  6. Credits

Setup

Starting from base project

  1. git clone --depth 1 git://github.com/fs/android-base.git --origin android-base [NEW-PROJECT-NAME]
  2. cd [NEW-PROJECT-NAME]
  3. git remote add origin https://github.com/[NEW-PROJECT-GITHUB-ACCOUNT]/[NEW-PROJECT-NAME].git
  4. git push -u origin master
  5. Update APPLICATION_ID in app/build.gradle.
  6. Rename package under app/src/main/java.
  7. Remove current and Credits sections from README.MD.

IDE

  1. Download latest Android Studio from https://developer.android.com/studio/index.html
  2. Follow Android Studio installation instruction.
  3. Download and install latest JDK8 http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html.
  4. Open Android Studio - Open Existing Android Project - find folder with project and click OK
  5. Wait a while. Follow Android Studio instructions to install missing items.
  6. Press cmd + shift + a and type AVD Manager and press Enter.
  7. Press Create Virtual Device... button.
  8. Select Nexus 5X
  9. Select latest API level (in case if latest is not available then click Download and wait, it's going to take a while).
  10. Click Next
  11. Click Finish

Updating secret keys

  1. Decrypt file:
openssl aes-256-cbc -d -md sha256 -nosalt -a -pass pass:{KEY} -in secrets/keys.properties.crypted > temp.properties
  1. Add/remove keys inside temp.properties
  2. Encrypt temp.properties back
openssl aes-256-cbc -e -md sha256 -nosalt -a -pass pass:{KEY} -in temp.properties -out ./secrets/keys.properties.crypted
  1. Clean up: rm temp.properties.

Building

Create APK

After you complete the Gradle project configuration, you can use gradlew executable to build the APK:

$ ./gradlew assembleDebug       // to build a debug APK
$ ./gradlew assembleRelease     // to build a release signed APK, can upload to Market

Install

To install app on emulator or connected real device:

$ ./gradlew installDebug

Deploying to Fabric

Deploy plugin configuring

Module build.gradle:

defaultConfig {
    ...
    oneClickPublish {
        branchNames = ["master"]    // branch names from which you can deploy, master by default
        remoteRepoName = "origin"   // alias repository, origin by default
    }
    ...
}

Deploy steps:

  1. To promote a new version run:
$ ./gradlew deployMajorVersion      //  increase major number
$ ./gradlew deployMinorVersion      //  increase minor number
$ ./gradlew deployPatchVersion      //  increase patch number
  1. Wait until https://circleci.com finish build.
  2. Open crashlytics application on Android device
  3. Find Android Base app, click on it and click "Update".
TODO publishing and tester's inviting

Publish to production

Invitation for testers

Run tests:

$ ./gradlew test

ProGuard

Project already has proguard config for included libraries. Maintain proguard-rules.pro updated when you add new libraries or play with reflection. When you add new library or check out its Proguard section and add rules to proguard-rules.pro. When you add code which uses reflection add rules to proguard-rules.pro.

Credits

Android base app is maintained by Flatstack. List of contributors