# Quick Start

This guide takes the SDK Demo App from the delivered source to a running app on your terminal.

## Before you begin

Confirm you meet the [Prerequisites](/en/getnet-toolbox/sdk-demo-app/first-steps-demo/prerequisites).

## Step 1: Get the project

The demo app source code is delivered inside the toolkit, already extracted, at `devkit-source/apolo-devkit/`. Open that folder in Android Studio through **File → Open…**.

Complete Step 2 before syncing the project.

## Step 2: Set the Gradle JDK to 21

The project compiles only with JDK 21. The typical sync error when it is missing is `Unsupported class file major version`.

1. Open **Settings** — on Windows and Linux `File → Settings`, on macOS `Android Studio → Settings`.
2. Go to **Build, Execution, Deployment → Build Tools → Gradle**.
3. Under **Gradle JDK**, select a JDK 21 — for example the bundled JetBrains Runtime 21 (`jbr-21`), or download one through **Download JDK…**.
4. Click **Apply/OK** and run Gradle **Sync** again.

## Step 3: Select the variant and run

The app defines the `country` flavor dimension with the `brazil` flavor as default, combined with the `debug` and `hml` build types. Run the default `brazilHml` variant.

For each variant, `app/build.gradle.kts` adds the SDK dependency as `com.pagonxt.sdk:<flavor>-<buildType>` — for example `com.pagonxt.sdk:brazil-hml`, version `1.0.0-SNAPSHOT`. It resolves from the local Maven repository bundled at `apolo-sdk-local-maven/brazil/<buildType>`.

**From Android Studio**

1. Open the **Build Variants** window through `View → Tool Windows → Build Variants`.
2. In the `:app` module, set **Active Build Variant** to `brazilHml`.
3. Select the `app` run configuration, connect the terminal, and click **Run**.

**From the command line**

```bash
## Default (Brazil) HML build — compiles and installs
./gradlew :app:installBrazilHml

## Unit tests
./gradlew :app:testBrazilHmlUnitTest
```

The `./gradlew :app:installBrazilHml` command completes and the app opens on the terminal.

## Step 4: Provide credentials

The demo app initializes the SDK with your integrator credentials: `clientId`, `clientSecret`, `terminalCode`, and the sub-merchant data. On the first launch, the **Setup** screen lets you type them manually or read them from a QR Code.

### Generate the QR Code

The demo app ships the `CredentialsQrCode` component at `app/src/main/java/com/pagonxt/apolo/devkit/internal/design/components/CredentialsQrCode.kt`. It uses **ZXing** to build a QR Code from a JSON payload.

The sample values live in two functions: `buildMandatoryCredentialsPayload()` for the mandatory credentials only, and `buildFullCredentialsPayload()` for the credentials plus the sub-merchant data.

```kotlin
private fun buildFullCredentialsPayload(): String {
    return JSONObject().apply {
        put("clientId", "...")
        put("clientSecret", "...")
        put("terminalCode", "...")
        put("subMerchantId", "...")
        put("city", "...")
        put("state", "...")
        put("postalCode", "...")
        put("document", "...")
        put("street", "...")
        put("phone", "...")
        put("corporateName", "...")
        put("url", "...")
        put("foreignType", "FULL_DOMESTIC")
    }.toString()
}
```

To use your own credentials:

1. Replace the values in `buildMandatoryCredentialsPayload()` or `buildFullCredentialsPayload()` with your onboarding data.
2. Open the `MandatoryCredentialsQrCode_Preview` or `FullCredentialsQrCode_Preview` Compose preview in Android Studio and click **Build & Refresh**.
3. Use the resulting QR Code on the Setup screen.

### Read the QR Code

On the **Setup** screen, choose the **read QR Code** option and point the terminal at the QR Code. The configuration fields fill automatically and the SDK initializes with the correct credentials.

## Step 5: Verify

Run through the checks below. Each one confirms a different part of the setup.

| Check | What to expect |
| :--- | :--- |
| Gradle sync | Completes without JDK errors such as `Unsupported class file major version`. |
| Dependency resolution | Resolves without credentials — the SDK comes from the bundled local Maven repository and the rest from Maven Central and Google. |
| Variant | `:app` is set to `brazilHml`. |
| Run | `./gradlew :app:installBrazilHml` completes and the app opens. |
| Initialization | After entering the credentials, the SDK warm-up reports success and the main menu appears. |

## Change the saved credentials

After the first save, the credentials persist in the app database and the demo app stops prompting Setup. To change them, use one of these:

* **Reset** — tap the reset button in the **Home** screen header to clear the credentials and return to Setup.
* **Clear app data** — go to **Settings → Apps → Apolo DevKit → Storage → Clear data**.
* **Reinstall the app.**

As a code alternative, fill in `CLIENT_ID`, `CLIENT_SECRET`, and `TERMINAL_CODE` in `SetupCredentials.kt` to initialize the SDK at build time and skip the Setup screen.

## Next steps

* [Customize the SDK](/en/getnet-toolbox/sdk-demo-app/how-to-guides-demo/customize-the-sdk) — the two customization models the demo app demonstrates.
* [Troubleshooting](/en/getnet-toolbox/sdk-demo-app/troubleshooting-demo/troubleshooting) — the common symptoms at each step above, and how to resolve them.
* [SDK White Label — Quick Start](https://docs.globalgetnet.com/en/products/in-store-payments/getnet-toolbox?doc=sdk-wl-quick-start) — integrate the SDK into your own app.
* `README.md` inside the extracted project at `devkit-source/apolo-devkit/` — repository overview, focus map, and per-client integration surface.