Skip to content

Latest commit

 

History

History
183 lines (119 loc) · 6.45 KB

File metadata and controls

183 lines (119 loc) · 6.45 KB
title Setting up your Development Environment
description A guide to setting up your development environment for Stoat for Android.
template doc

This page contains the guidelines for setting up your development environment for Stoat for Android. These guidelines are important to ensure that your development environment is set up correctly and you can start contributing to the project.

If you want to compile the app yourself, you can follow these guidelines. You may not need Android Studio, as it’s possible to build the app from the command line. GitHub Codespaces automates most of the process for you if you want to go that route and this guide covers those steps, but won’t go into detail on other command-line methods.

:::danger It may be tempting to skip some of these steps, but make sure you follow them to ensure that your development environment is set up correctly.

Note: If you are doing this in Github Codespaces, steps 1-10 will be done for you. Also note that while small codespace instances can build this app, it's recommend to use 8-core or above for best results. :::

import { Tabs, TabItem, Steps } from "@astrojs/starlight/components"

  1. Download the Git version control system.

    winget install --id Git.Git -e --source winget

    Using Homebrew:

    brew install git

    Using your package manager. For example, on Ubuntu:

    sudo apt install git
  2. Download Android Studio.

    winget install --id Google.AndroidStudio -e --source winget

    From the official website.

    Look for Android Studio in your package manager.

    Alternatively, from Flathub or the official website.

  3. Download Deno.

    Please see the Deno Runtime Manual for installation guidance.

  4. Clone the repository.

    git clone --recursive https://github.com/stoatchat/for-android.git

    Specify --recursive to ensure that submodules are cloned as well.

  5. Open the project in Android Studio.

    :::caution Android Studio will automatically attempt a Gradle sync when the project is first opened. This sync will fail until steps 8-10 are completed. You can safely dismiss the sync failure and proceed through the remaining steps before syncing manually via File > Sync Project with Gradle Files. :::

  6. Install the required dependencies.

    • Android SDK, latest version
    • Android NDK, latest version

    You can install these from the SDK Manager in Android Studio.

  7. Download required additional, embedded dependencies using the provided script.

    deno run -A scripts/download_deps.ts

    :::tip You can run this script with the -y flag to skip confirmation prompts. :::

    :::note This script will query the Stoat version control server for the latest version of the final-markdown native library and download it. If you do not wish to use pre-built libraries, you can build final-markdown yourself from the source code at https://git.revolt.chat/android/final-markdown, and copy the files to the app/src/main/jniLibs folder. Note the files that are downloaded are exactly the same as the ones we use for the app on Google Play, so you can be sure they are safe to use. :::

  8. Copy the stoatbuild.properties.example file to stoatbuild.properties and fill in the required values.

    cp stoatbuild.properties.example stoatbuild.properties

    The stoatbuild.properties file contains the following properties:

    Property Description
    sentry.dsn Sentry DSN for error reporting
    sentry.upload_mappings Whether to upload obf. maps to Sentry
    build.debug.app_name The name of the app in debug builds, arbitrary
    build.flavour_id Leave as ZZUU
  9. Copy the sentry.properties.example file to sentry.properties and fill in the required values.

    cp sentry.properties.example sentry.properties

    The sentry.properties file contains the following properties:

    Property Description
    defaults.url The URL of the Sentry instance
    defaults.project The project ID in Sentry
    defaults.org The organization ID in Sentry
    auth.token The authentication token for Sentry, used to upload maps

    You can get these values from the Sentry dashboard.

  10. Copy the google-services.json.example file within the app directory to google-services.json.

    Firebase services are integrated into the project, so we need a google-services.json file for the build to succeed. For development purposes, use the provided example file:

    cp app/google-services.json.example app/google-services.json

    :::note This is a mock configuration file for development purposes only. In a production environment, you would use a real Firebase project configuration. :::

  11. Build the project.

    You can build the project by clicking on the 'Run' button in Android Studio.
    If asked, build the :app module.

    If building within Github Codespaces, you can build a fresh debug apk by running ./gradlew assembledebug --no-daemon from the root of the project. Upon completion, the apk will be within app/build/outputs/apk/debug/

  12. You're all set! You can now start contributing to Stoat for Android.