Bitbucket, a popular Git repository management tool, allows developers to host and share their code repositories. When combined with Android Studio, Google’s official integrated development environment (IDE) for Android apps, developers can seamlessly manage and version-control their app projects. Here’s a step-by-step guide to configure Android Studio with Bitbucket:

1. Prerequisites:

  • Ensure you have an active Bitbucket account. If not, sign up here.
  • Android Studio installed on your machine.

2. Install Git on Your Machine:

Android Studio uses Git as the version control system. If you haven’t already, install Git:

  • For Windows: Download the installer from git-scm.com and follow the instructions.
  • For macOS: Install Git using Homebrew with brew install git.
  • For Linux: Use the package manager for your distribution, e.g., sudo apt-get install git for Debian/Ubuntu.

3. Configure Git in Android Studio:

  • Launch Android Studio.
  • Go to File > Settings (or Preferences on macOS) > Version Control > Git.
  • In the ‘Path to Git executable’ field, ensure the path points to the Git executable. If not, browse and select the correct path.
  • Click Test to ensure Android Studio can run Git.

4. Connect Android Studio to Bitbucket:

  • Go to File > Settings (or Preferences on macOS) > Version Control > GitHub.
  • Change the Host to bitbucket.org.
  • Enter your Bitbucket username and password or use the Token option.
  • Click Test to ensure the connection is successful and then click OK.

5. Clone Your Bitbucket Repository:

  • In Android Studio, select File > New > Project from Version Control > Git.
  • Enter your Bitbucket repository URL. You can get this from your Bitbucket dashboard by clicking on the desired repository and selecting Clone.
  • Choose a directory for your project and click Clone.

6. Make Changes and Commit:

After making changes in your Android project:

  • Go to VCS > Commit, or use the shortcut Ctrl+K (Cmd+K on macOS).
  • Select the files you want to commit, enter a commit message, and click Commit.

7. Push Changes to Bitbucket:

  • Go to VCS > Git > Push, or use the shortcut Ctrl+Shift+K (Cmd+Shift+K on macOS).
  • Select the commits you want to push and click Push.

Note: Always ensure to pull the latest changes from the repository before starting your work to avoid conflicts.

Conclusion:

Configuring Android Studio with Bitbucket streamlines the app development process, offering a unified environment for coding, version control, and collaboration. With this integration, developers can focus more on coding and less on managing version control tasks manually.