Android App Setup in Android Studio

A comprehensive step-by-step guide on how to configure your Android project, change its Package Name appropriately, and link your backend API URL.

1

Opening the Project in Android Studio

Ensure that you have installed the latest version of Android Studio. If you haven't, please download it from the official Google developer portal.

  1. Launch Android Studio.
  2. Click on Open from the welcome screen, or go to File > Open.
  3. Navigate to the directory where you extracted the Android app source code and select the root folder of the project.
  4. Wait for Android Studio to index the files and complete the initial Gradle Sync. This might take a few minutes.
Open Android Studio Project Android Studio Workspace
Tip: Always ensure you have a stable internet connection during the first Gradle sync, as it needs to download several dependencies.
2

Changing the Package Name (Part 1 - Setup)

To successfully change the package name (the unique identifier for your app on the Google Play Store), you need to change how the project structure is displayed.

  1. In the left Project Panel, make sure you are in the Android view.
  2. Click on the Gear Icon (Settings) located at the top right of the Project Panel.
  3. Uncheck the option Compact Middle Packages (or Compact Empty Middle Packages, depending on your Android Studio version).

Disabling this option visually separates the package folders (e.g., com.example.app becomes three separate folders: com > example > app), allowing you to rename the specific part of the package name you want.

Options Menu for Package View Unchecking Compact Middle Packages
3

Changing the Package Name (Part 2 - Rename & Refactor)

Now that your directories are separated, you can comfortably rename your application's unique ID.

  1. Navigate to app > java. Your current package name will be split (e.g., com, then the middle name, then the app name).
  2. Right-click on the folder you wish to rename (usually the middle name or the app name).
  3. Select Refactor > Rename (or press Shift + F6).
  4. A prompt might appear asking if you want to rename the directory or the package. Select Rename package.
  5. Enter your new identifying name in the dialog box and click Refactor.
Refactor Package Name

In the bottom-left pane, Android Studio will preview the changes. Click Do Refactor to finalize updating the paths everywhere in your Android code.

Do Refactor Confirmation
4

Linking to Your API Domain

For your application to communicate with your server, you must assign your specific backend domain URL to the app's configuration.

  1. In the left project explorer, navigate to the constant strings or API configuration file as shown below.
  2. Locate the BASE_URL or API_URL constant variable.
  3. Replace the default placeholder URL with your actual administrative domain endpoint (e.g., https://your-domain.com/).
  4. Save the file.
Watch Out: Ensure your domain URL ends with a forward slash / if required by your network configuration, and always use https:// for security.
Change API Domain URL
5

Updating Final App Configurations

To conclude the setup, review any remaining configuration strings associated with your app name and services.

  1. Navigate to your manifest or build.gradle file (Module: app) to verify the applicationId matches your new package name.
  2. Check your strings.xml file (under res > values) and update your app_name string to your desired public application name.
  3. Review the remaining configuration parameters indicated in the file below to ensure all URLs, API keys, and environment variables are properly mapped to your hosting layout.
  4. Once done, run Build > Clean Project followed by Build > Rebuild Project.
Update Application Configuration
🚀 All Done! You have successfully updated the package name and linked the API. You can now build your APK/AAB and deploy your custom Android app!
×