• Home
More

    Substratum Theme Development: Project Setup

    Project setup

    There are two ways to setup the project and build on your computer:

    1. Android Studio IDE

    Prerequisites:

    • Android Studio with Android SDK
    • JDK(Java Development Kit)

    2. Command-line(Recommended for low-end PCs)

    Prerequisites:

    • Only Android SDK
    • JDK

    Setting up the project with Android Studio

    Android Studio is Google’s official IDE (integrated development environment) which is based on Jetbrain’s IntelliJ IDEA for Android Operating System.

    There are two ways for Setting up the project with Android Studio:
    1. Git clone (recommended)
    2. Download source-code as a zip

    Git clone (recommended)

    1. After installing Android studio and setting up SDK, copy the repo URL of template.

    Copy repository URL – Github

    2. Open Android studio and click on Checkout project from version control and select the version control service on which your project being hosted on (In this case it’s Git).

    Checkout Version Control – Android Studio

    3. Paste the copied repo URL and change directory of clone if necessary and click Clone.

    Git clone setup

    4. Android studio will start cloning the repo.

    Git clone progress

    5. It will throw a prompt saying whether you want to create android studio project for the checked out/cloned source, select Yes.

    Git clone checkout

    6. Now it’ll show import window. Select Import projects from external model and click Next.

    Git clone project import

    7. Gradle setup window will appear, now click on Finish.

    Git clone gradle setup

    Downloading the zip from Github

    1. Open template repo and click on Clone or download and select Download ZIP.

    Manual Download Setup – Android Studio

    2. Save and extract it.

    Extracting Archive

    3. Open Android studio and click on Import project (Gradle, Eclipse, ADT etc.).

    Manual Import – Android Studio

    4. Browse to the extracted template directory and press OK.

    Browse for downloaded repo

    After importing project, Android studio will try to sync gradle. If the project using outdated gradle distribution then it'll throw a prompt to update gradle version manually. Click Update.

    Gradle outdated

    And the gradle synced successfully!.

    Gradle sync complete

    Setting up “Run” configuration

    Run is a very handy feature for testing new changes as quickly as possible. It will compile the source and automatically installs to the device which is connected through ADB.

    As theme template doesn’t comes with any launch-able activity, we need to setup the Run configuration to launch nothing, so that it can compile & install silently without launching any activity.

    1. Press App button and click on Edit configuration.

    Edit configurations

    2. Click on Launch:, select activity to Nothing and press OK.

    Edit config setup

    3. Connect phone using USB and press Run icon to start compiling and install into the connected device.

    Launch Run

    Android studio will open dialog with a list of devices connected to "ADB". Select the device you want Android studio to install the app after compilation.

    Select device dialog

    Disable Instant run

    Instant run is a latest feature of Android studio which pushes only updated code and resources to your connected device by performing swap which might cause issues with template as we do changes only on assets most of the time. So its recommended to disable Instant run.

    1. Open Android studio Settings.

    Android Studio Settings

    2. Select Build, Execution, Deployment and uncheck the Instant run option and press OK.

    Uncheck instant run

    Setting up the project with command-line

    The command-line method is the simple & easiest way compared to Android studio method and its the recommended option for low-end or old PC’s.

    Before proceeding further, make sure Android SDK is installed and following environment variables are set:

    JDK_HOME = JDK installed path
    JRE_HOME = JRE installed path
    ANDROID_HOME = Android SDK installed path

    Environment Setup

    1. Either clone the template using Git for Windows or download the template as a zip(only first two steps) and extract it.

    2. Open the cloned/extracted directory and hover mouse to empty area and hold shift + right click and select Open PowerShell window here or if you’re on older version of windows, select Open command line window here.

    Open command line window

    3. In the command window, type ./gradlew assembleDebug and press Enter. Gradle wrapper will begin downloading dependencies and will setup everything automatically.

    Gradle is syncing dependencies required for the project.

    Dependencies sync

    Gradle is compiling the project after syncing successfully.

    Compiling Project

    Project is successfully compiled.

    Project compilation successful

    4. To build and install app to the connected device, type ./gradlew installDebugin the command line and press Enter.

    Recent Articles

    Google I/O 2019 everything you need to know

    Cut to the chase Google I/O 2019: May 7-9 at the Shoreline Amphitheatre in Mountain View, CA Schedule for sessions and codelabs are out...

    The First Ever Pictures of Event Horizon has been Captured by the Astronomers, Let us see how the super massive Black Hole actually looks...

    For last several centuries, black holes have been the most fascinating topic for the Astronomical Society. But there was not a single photograph of...

    Google finally removed the Notification bell icon from its web applications

    Last month Google has declared, it is going to deprecate the notification icon on the top right corner of the screen starting from 7th...

    Google is expanding its Duplex service to 43 states

    If you have watched last years Google I/O, you must have an idea about what Google Duplex actually is. If you do not have...

    Google launches Bolo reading-tutor app in India, get on Play Store

    When it comes to education and Google, we think of Google Classroom and Google Scholar. India is a place where a lot of children...

    Related Stories

    Leave A Reply

    Please enter your comment!
    Please enter your name here

    Stay on op - Ge the daily news in your inbox