Android Studio SDK Integration
This guide shows how to integrate the Phenix Android SDK into a new project in Android Studio 2022 and higher using Kotlin DSL. The following is a step-by-step approach to integrate the Phenix Android SDK into a new Kotlin DSL project.
Create a New Project (Kotlin DSL)
Create a new project for integration of the Phenix SDK.
-
Download and install Android Studio.
-
From the File menu in Android Studio, select New > New Project, select any project template, and click Next.
-
In the New Project popup, name your application, name your package, enter your project save location, select API 23 as the minimum SDK, and select Kotlin DSL (build.gradle.kts) as the build configuration language.
Register a Github token for Phenix SDK access
For Android Studio and Gradle to be able to access the Github-hosted Phenix SDK packages, register an access token to be used in the configuration.
-
Log into your Github account and go to the tokens page.
-
Generate a new token which includes the read:packages capability.
-
Add a line containing a
github.token
key and the value of the token to your localgradle.properties
file.- On Mac or Linux, create and/or edit the
$HOME/.gradle/gradle.properties
file. - On Windows, create and/or edit the
C:\Users\username\.gradle\gradle.properties
file, whereusername
is your Windows user name.
- On Mac or Linux, create and/or edit the
github.token = <personal github access token with read:packages capability>
Add the Phenix SDK to the New Project (Kotlin DSL)
- In
settings.gradle.kts
, modify thedependencyResoluton
such that it is able to authenticate with the Github Maven repository, using the token that was configured earlier.
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven("https://maven.pkg.github.com/PhenixRTS/AndroidSDK") {
credentials {
username = ""
password = extra["github.token"].toString()
}
}
}
}
- On the app-level, alter the
build.gradle.kts
to reference the Phenix SDK package we want to import into the project. The example below references 2022.0.3 in thecom.phenixrts.android:phenix-sdk-android
package.
dependencies {
implementation("com.phenixrts.android:phenix-sdk-android:2022.0.3")
...
}
Start using the Phenix SDK
After completing these steps, com.phenixrts.*
classes can be imported into the project.