Skip to main content

Android - Configure Your Project

A freshly cloned DevApp is a template. It ships with a generic library module named module_name, a placeholder package (com.q2.package_name), an unset group identifier, and a set of example modules that exist only to demonstrate the SDK. Before you start writing your own code, you need to turn this template into your project: rename the module, rename the package, set your group identifier, and remove the example code.

This page walks through that one-time conversion in order.

Before you start

Complete DevApp Setup first. You should have the project cloned, your Personal Access Token in settings.gradle, a successful Gradle sync, and the app running on a device or emulator. Do the steps below after you have confirmed the template builds and runs unmodified — that way, if something breaks, you know it was a change you made.

Work on a branch

Make these changes on a fresh Git branch and commit after each major step (rename, package move, cleanup). Renames touch many files at once; small commits make it easy to back out a mistake.

What the template ships with

ItemShips asYou change it to
Library module directory / Gradle pathmodule_name / :module_nameYour module name
Group identifier (moduleGroupId)com.q2.module_nameYour distinct group id
Source packagecom.q2.package_nameYour real package
Example module classesSeven Example*.kt classesDeleted
Root project name"[Your Module's] DevApp"Your project name

There are two different generic tokens, and they are not the same:

  • module_name — the Gradle module directory and project path (:module_name), and the value that feeds the generated R class package (via moduleGroupId).
  • package_name — the Kotlin source package the example files live in (com.q2.package_name).

The template ships with these mismatched (the source is in com.q2.package_name but ExampleUIModule.kt imports com.q2.module_name.R). The steps below reconcile both to your own package.

1. Rename the library module

The library module is the directory module_name/ at the project root. Rename it to match your module — for example, my_payments_module/.

  1. Rename the folder module_name/ on disk (in Android Studio: right-click the module → Refactor → Rename, or rename the directory directly).

  2. Update the module include in settings.gradle:

    // Before
    include ':module_name'
    // After
    include ':my_payments_module'
  3. Update the dependency the DevApp host has on your module in devapp/build.gradle:

    // Before
    implementation project(':module_name')
    // After
    implementation project(':my_payments_module')

Sync Gradle. Both references must point at the new module path or the build will fail.

2. Set your group identifier

The module's group identifier lives in gradle.properties, not settings.gradle. It is used both for publishing your module and as the library's Android namespace (which in turn determines your generated R class package).

Open gradle.properties and change:

# Before
moduleGroupId=com.q2.module_name
# After — use a group id distinct to your organization and module
moduleGroupId=com.example.payments
This must be renamed

moduleGroupId must be changed to a value distinct to your module. Leaving it as com.q2.module_name will collide with the template and other modules when publishing.

3. Rename the source package

The example code lives in the source package com.q2.package_name, under module_name/src/main/java/com/q2/package_name/. Rename it to your real package — ideally matching your moduleGroupId from the previous step.

The cleanest way is Android Studio's refactoring:

  1. In the Project view, switch to the Project (not Android) file tree so you can see the full package path.
  2. Right-click the com.q2.package_name package → Refactor → Rename.
  3. Choose Rename package, enter your new package (for example, com.example.payments), and let Android Studio update every declaration and import.

If you rename manually instead:

  • Move the directory module_name/src/main/java/com/q2/package_name/ to your package path.
  • Update the package declaration at the top of every .kt file.
  • Fix the R class import in ExampleUIModule.kt — it imports com.q2.module_name.R, which must become <your.namespace>.R (your moduleGroupId from step 2).
Reconcile both tokens

Because the template mismatches the source package (com.q2.package_name) and the R namespace (com.q2.module_name), make sure both point at your single new package after this step. The Android Studio rename plus a fixed R import handles this.

4. Remove the example code

The library module ships with seven example classes that only demonstrate the SDK interfaces. Delete the ones you do not need — most projects delete all of them and start fresh from the Modules documentation.

Delete from <your-module>/src/main/java/<your-package>/:

  • ExampleCombinedModule.kt
  • ExampleDeepLinkModule.kt
  • ExampleLifecycleModule.kt
  • ExampleMethodModule.kt
  • ExampleNotificationModule.kt
  • ExampleSecurityModule.kt
  • ExampleUIModule.kt (also defines ExampleUIModuleActivity)

Also clean up the supporting demo resources and manifest:

  • Delete the demo layout <your-module>/src/main/res/layout/activity_test.xml (only ExampleUIModuleActivity used it).
  • In <your-module>/src/main/AndroidManifest.xml, remove the example activity declaration. Note it references .UIModuleTestActivity, which does not match the actual class name (ExampleUIModuleActivity) — it is example scaffolding and should go regardless.
Keep the library dependencies

Do not remove the com.q2.msdk:sdk_interfaces dependency in your module's build.gradle — it provides the module interfaces your code implements. You can trim the other libraries (material, firebase-messaging, gson, etc.) down to what your module actually uses.

5. Clean up settings.json

The DevApp's runtime config, devapp/assets/conf/settings.json, wires the example modules in by class path. Since you deleted those classes, remove their entries.

Open devapp/assets/conf/settings.json and, in the sdk_modules array, delete the six example entries whose identifier / classPath reference com.q2.package_name.*. Add your own module entry in their place, and point targetURLBase at your sandbox.

Full field-by-field guidance is on the next page, Setting Up settings.json. For now, the important part is that no com.q2.package_name.* example entries remain.

6. Set your project and version values

A few remaining placeholders identify your project and pin the SDK version:

  • settings.gradlerootProject.name ships as "[Your Module's] DevApp". Set it to your project's name.
  • gradle.propertiessdkVersionName is your module's release version (start at 1.0.0 and increment per release). q2Version selects which DevApp Core / SDK version-catalog release you build against; confirm it matches the version your Q2 representative directed you to.

Optional configuration

These steps are only needed for specific features. Skip any that do not apply.

Firebase (push notifications)

devapp/google-services.json ships with placeholder tokens ({project_number}, {app_id_here}, {api_key_here}). If your module uses push or notifications, replace this file with the google-services.json from your own Firebase project.

InboundSSO

If you use InboundSSO, uncomment the InboundSSO dependency and the webAuthenticationRedirectScheme / manifestPlaceholders block in devapp/build.gradle, and set the redirect scheme to match your configuration.

Rebranding the host app

By default, leave the DevApp host app id as com.q2.devapp — it is just the test harness, not your shipped module. If you do choose to rebrand it (changing namespace and applicationId in devapp/build.gradle), you must keep the "package" field in settings.json in sync with the new applicationId. A mismatch between the two will prevent the app from loading correctly.

Leave these alone

Some parts of the template are infrastructure and should not be changed:

  • devapp/.../DevAppApplication.kt — marked "Do not modify this class."
  • com.q2.msdk:sdk_interfaces and com.q2.app.core:core dependency lines — do not remove them; to change the SDK version, update the q2Version property instead of editing these lines directly.
  • msdk_repo_token in settings.gradle — required for CI; leave it in place (this is separate from your Personal Access Token, which you added in DevApp Setup).

What's next

With the template converted into your own project, confirm you are on the right JDK with Java Versions, then configure which modules the app loads at Setting Up settings.json. When your project is configured, head to the Modules section to start writing module code.