I am using Libgdx + Android Studio and trying to implement Google Play Billing. I follow the instructions from here. I modify my dependencies as it is shown in te example:
dependencies {
...
implementation 'com.android.billingclient:billing:1.1'}
So my build.gradle looks like this:
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
ext {
appName = "Test"
gdxVersion = '1.9.8'
roboVMVersion = '2.3.3'
box2DLightsVersion = '1.4'
ashleyVersion = '1.7.0'
aiVersion = '1.8.0'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
jcenter()
}
}
project(":desktop") {
apply plugin: "java"
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
implementation 'com.android.billingclient:billing:1.1'
}
}
project(":android") {
apply plugin: "android"
configurations { natives }
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-
v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-
v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
implementation 'com.android.billingclient:billing:1.1'
}
}
project(":core") {
apply plugin: "java"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
implementation 'com.android.billingclient:billing:1.1'
}
}
tasks.eclipse.doLast {
delete ".project"
}
The problem is when I try to use the code from example I get errors. For this code
private BillingClient mBillingClient;
I get the error "Cannot find symbol class BillingClient". When I try to do this:
import com.android.billingclient.api.BillingClient;
I get the error "package com.android.billingclient.api.BillingClient does not exist".