I am trying to implement in-app purchases for my project that uses gradle in Android Studio.
My problem is that I do not know how to include Android-sdk in the project.
For example, if I try to create something simple, for example, an IabHelper object, it cannot even be resolved (which makes me think that the library is not working).
Does anyone have any experience with this? I try to resolve this all day in my personal time on my day off, very frustrating.
My current gradle file:
buildscript { repositories { mavenCentral() mavenLocal() } dependencies { classpath 'com.android.tools.build:gradle:0.13.2' classpath 'com.github.jtakakura:gradle-robovm-plugin:0.0.9' } } allprojects { apply plugin: "eclipse" apply plugin: "idea" version = '1.0' ext { appName = 'MyAppName' gdxVersion = '1.4.1' //roboVMVersion = '0.0.13' roboVMVersion = '1.0-beta-01' } repositories { mavenLocal() mavenCentral() maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } maven { url "https://oss.sonatype.org/content/repositories/releases/" } } } 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" compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop" compile "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-desktop" compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop" compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion" compile "com.badlogicgames.gdx:gdx-controllers-desktop:$gdxVersion" compile "com.badlogicgames.gdx:gdx-controllers-platform:$gdxVersion:natives-desktop" } } 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-x86" compile "com.badlogicgames.gdx:gdx-bullet:$gdxVersion" natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-armeabi" natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-armeabi-v7a" natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-x86" compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi" natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a" natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86" compile "com.badlogicgames.box2dlights:box2dlights:1.2" compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86" compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion" compile "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion" } } project(":ios") { apply plugin: "java" apply plugin: "robovm" configurations { natives } dependencies { compile project(":core") compile "org.robovm:robovm-rt:${roboVMVersion}" compile "org.robovm:robovm-cocoatouch:${roboVMVersion}" compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios" natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-ios" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios" compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-ios" } } project(":core") { apply plugin: "java" dependencies { compile "com.badlogicgames.gdx:gdx:$gdxVersion" compile "com.badlogicgames.gdx:gdx-bullet:$gdxVersion" compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" compile "com.badlogicgames.gdx:gdx-bullet:$gdxVersion" compile "com.badlogicgames.box2dlights:box2dlights:1.2" compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion" //compile "com.badlogicgames.gdx:gdx-ai:1.4.0" compile 'net.dermetfan.libgdx-utils:libgdx-utils:0.4.0' compile 'net.dermetfan.libgdx-utils:libgdx-utils-box2d:0.4.0' // Box2D module } } tasks.eclipse.doLast { delete ".project" }
** UPDATE **
Unfortunately, I could not solve this problem after a whole week of efforts, I even reformatted my MAC and completely rebooted everything, it did not work. Gradle ...
Anyway, I decided using an excellent third-party library, which requires only one line of code:
https://github.com/anjlab/android-inapp-billing-v3
source share