Setup

Add gptdriver Android library to your dependencies. (Maven Central)

build.gradle.kts
dependencies {
    // ...
    implementation("io.mobileboost.gptdriver:gptdriver-lib:1.3.1")
    // ...
}

Import the library in your java code

import io.mobileboost.gptdriver_lib.GptDriver;

If needed, add packaging exclude rules in the android section of the build.gradle.kts (:app) file

To resolve build failures caused by duplicate metadata files from dependencies, exclude them from the packaging process.

build.gradle.kts (:app)
android {
    // ...
    packaging {
        resources {
            excludes.addAll(listOf("META-INF/INDEX.LIST", "META-INF/io.netty.versions.properties"))
        }
    }
    // ...
}

If not already present, add internet permissions to the AndroidManifest.xml file

AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- ... -->
    
    <uses-permission android:name="android.permission.INTERNET" />
    
    <application>
        <!-- ... -->
    </application>
    <!-- ... -->
</manifest>

Last updated