Create a Gradle Project

Create a Gradle Project

Create a “starting” Gradle/Kotlin project and save it in Git.

Steps

Step 1. Getting working copy

First, you need to git clone your GitLab repository to your local machine so that you have a working copy.

Open the web page for your GitLab project. Click on the Code button, and copy the URL from Clone with HTTPS.

GitLab

In a terminal, on your computer, cd to the location where you want to keep your source code. git clone the URL.

$ git clone https://git.uwaterloo.ca/cs346/public/mm.git

In this example, we would have a folder named mm that contains the contents of the Git repository.

Step 2. Create empty project

You will want to create a project directly in your Git working copy. IntelliJ IDEA and Android Studio both fully support Gradle, and we can create a new project directly in the IDE.

Determine which platforms you want to support. This determines which type of project you should create! Follow the instructions that match your project:

If you are working on Android, you will also want to add an Android Virtual Device on each person’s computer. This will let you run Android applications without requiring a physical phone. In IntelliJ IDEA:

  • Tools > Device Manager
  • +, Create Virtual Deviceand walk through the wizard to add an emulated device for testing.

Step 3. Update .gitignore

Check that you have a .gitignore file in your source tree. It should include at a minimum .idea and build/ folders.

Step 4. Push changes

Once you have confirmed that your project is working, you can commit and push the changes.

$ git add *
$ git commit -m "Initial commit"
$ git push

Step 5. Share with everyone

Your teammates should now be able to git clone the project URL to get a copy of this repository.

Final Word

Git
XKCD: Git