2. Requirements & Project Setup
2.1 Get Access to the SDK Registry
The SDK is distributed as a versioned package via GitHub Packages — not as a loose .aar file. Before your build can resolve it:
- Ask your Octopus TMS contact to add your GitHub account as a Read-only outside collaborator on the Macrotech-Solution/Octopus-TMS-SDK repository.
- Generate your own classic Personal Access Token: GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic) → scope it to read:packages only.
- Add it to ~/.gradle/gradle.properties on your machine (never inside the project, never committed):
gpr.user=your-github-username
gpr.key=ghp_your_read_only_token
WARNING
Tokens are personal. Do not share yours, and never paste it into a build file, a commit, or a chat. Access is revocable at any time by removing your account as a collaborator.
2.2 Gradle Dependency
Add the GitHub Packages repository to your project-level build.gradle, then depend on the SDK by coordinate in your module-level build.gradle — no local file, no libs/ folder.
// build.gradle.kts (project-level) — repositories block
repositories {
google()
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/Macrotech-Solution/Octopus-TMS-SDK")
credentials {
username = System.getenv("GITHUB_ACTOR")
?: (project.findProperty("gpr.user") as String?)
password = System.getenv("GITHUB_TOKEN")
?: (project.findProperty("gpr.key") as String?)
}
}
}
// build.gradle.kts (module) — dependencies block
dependencies {
implementation("com.octopus.sdk:octopus-tms-pos-sdk:2.0.7")
implementation("androidx.fragment:fragment-ktx:1.8.9")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("com.squareup.okhttp3:okhttp:4.12.0")
implementation("com.google.code.gson:gson:2.10.1")
implementation("com.jakewharton.timber:timber:5.0.1")
}
// build.gradle (project-level, Groovy DSL) — repositories block
allprojects {
repositories {
google()
mavenCentral()
maven {
url "https://maven.pkg.github.com/Macrotech-Solution/Octopus-TMS-SDK"
credentials {
username = System.getenv("GITHUB_ACTOR") ?: project.findProperty("gpr.user")
password = System.getenv("GITHUB_TOKEN") ?: project.findProperty("gpr.key")
}
}
}
}
// build.gradle (module, Groovy DSL) — dependencies block
dependencies {
implementation "com.octopus.sdk:octopus-tms-pos-sdk:2.0.7"
implementation 'androidx.fragment:fragment-ktx:1.8.9'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.jakewharton.timber:timber:5.0.1'
}
NOTE
The SDK internally uses OkHttp for TMS communication and Gson for JSON serialisation. Its bundled OEM driver AARs (e.g. the Dspread reader library) already ship their own BouncyCastle classes — do not add org.bouncycastle:bcprov-jdk15on yourself, or your build will fail with duplicate-class errors.
VERSIONING
Published versions on the registry are immutable — pin an exact version (never a range) and bump it deliberately when you want a fix or a new device driver. Check the repository's Packages tab for the latest available version.
2.2 ViewBinding — Why It Is Mandatory
The SDK's internal UI components are built using Android ViewBinding.
android {
buildFeatures {
viewBinding = true
}
}
android {
buildFeatures {
viewBinding true
}
}
2.3 ConstraintLayout — Why It Is Mandatory
WARNING
Without ConstraintLayout the app will crash at runtime with an InflateException.
android.view.InflateException:
Error inflating class
androidx.constraintlayout.widget.ConstraintLayout
2.3 AndroidManifest Permissions
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- Bluetooth: required by OEM card readers (e.g. Dspread) the SDK drives -->
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
<!-- Android 12+ (API 31+) runtime Bluetooth permissions -->
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
WARNING
ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION are runtime permissions on Android 6.0 and above. On Android 12+ (API 31+), missing BLUETOOTH_SCAN / BLUETOOTH_CONNECT does not fail your build — the app installs fine — but the SDK will silently fail to discover or connect to a Bluetooth card reader at runtime. Cap the legacy BLUETOOTH / BLUETOOTH_ADMIN permissions at maxSdkVersion 30 exactly as shown; omitting the new permissions is the most common cause of "reader not found" reports on newer devices.