Skip to content

Copies of the templates used by Android Studio when creating a new project.

Notifications You must be signed in to change notification settings

sebastiancarlos/android-studio-new-project-original-templates

Repository files navigation

Android Studio "New Project" Original Templates

This repository contains copies of the original templates used by Android Studio when creating a new project.

Last updated: 2024-02-11

The templates included are:

  • NoActivity
  • EmptyActivity
  • BasicViewsActivity
  • BottomNavigationViewsActivity
  • EmptyViewsActivity
  • NavigationDrawerViewsActivity
  • ResponsiveViewsActivity
new-project

Note: The two C++ templates are not included.

Rationale

The purpose of this repository is to keep copies of the templates, so that you can use them even if you don't have Android Studio installed.

For instance, some developers prefer a minimal setup, which doesn't include a full-blown IDE: It is possible to develop Android apps using just the Android SDK (maybe including the device emulator) and a terminal text editor, such as Vim or Emacs.

Unfortunately, the "New Project" templates are not available as a standalone CLI tool. They are not easily accessible from the Android Studio source code either. So you pretty much need to have Android Studio installed to get them. The aim of this repository is to provide them in a standalone form.

Usage

To use this repository, simply clone it:

git clone https://github.com/yourusername/android-studio-templates.git

You will find one folder for each template, containing the files as would be generated by Android Studio, with minimal changes (see below). Each of these folders is a standalone Android project, which can be build with Gradle and run on an Android device or emulator.

Template Information

The templates were generated with the following settings:

settings
  • Android Studio version: 2023.1.1 (Latest at the time of writing)
  • Language: Kotlin
  • Minimum SDK: API 25, Android 7.1.1 (Highest SDK version with over 95% coverage)
  • Build Configuration Language: Kotlin DSL.

The following superfluous files and folders were removed:

  • local.properties (only relevant for use with Android Studio)
  • .idea (only relevant for use with Android Studio)
  • .gradle (build system cache)

Update Policy

I personally vow to keep this repository up to date as new versions of Android Studio are released. This is achievable through the use of an uncomitted script which tests and diffs the templates as new versions are released.

CLI

This repo also comes with a simple CLI tool written in Bash:

Usage: ./android-new-project <template-name> <project-name>
       ./android-new-project --list/-l
       ./android-new-project --help/-h

  - <template-name> is the name of the template you want to use.
  - <project-name> is the name of the project you want to create. A folder
    with this name will be created in the current directory, and the template
    files will be copied into it.
    - This name will be converted to lowercase and CapitalizedCase, and used to name folders
      and replace content accordingly.
  - --list/-l will list the available templates.
  - --help/-h prints this help.

Available templates:
  - NoActivity
  - EmptyViewsActivity
  - BottomNavigationViewsActivity
  - NavigationDrawerViewsActivity
  - ResponsiveViewsActivity
  - EmptyActivity
  - BasicViewsActivity

If you want to install it system-wide, simply run make install.

Indeed, you can add or modify templates in your local copy of this repository, and they would be available to the CLI tool too.