Like adding AdMob to the libgdx project on Android Studio



  • On the Internet, there are instructions to add AdMob to the libgdx project, but to Eclipse. And I've done a game in Android Studio, but I need to add a line (compile 'com.google.android.gms:play-services-ads:8.4.0') to the gradle, but where I didn't make a mistake all the time. In the eclips, instead, you should have indicated a folder (google_play_services).

    buildscript {
        repositories {
            mavenCentral()
            mavenLocal()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:1.1.0'
    
    }
    

    }

    allprojects {
    apply plugin: "eclipse"
    apply plugin: "idea"

    version = '1.0'
    ext {
        appName = 'Boom-Boom'
        gdxVersion = '0.9.9'
        roboVMVersion = '0.0.13'
    }
    
    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"
    }
    

    }

    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 fileTree(dir: '../libs', include: '*.jar')
        compile 'com.google.android.gms:play-services-ads:8.4.0' //тут ошибку выдает
    
    }
    

    }

    project(":core") {
    apply plugin: "java"

    dependencies {
        compile "com.badlogicgames.gdx:gdx:$gdxVersion"
        compile fileTree(dir: '../libs', include: '*.jar')
    
    }
    

    }

    tasks.eclipse.doLast {
    delete ".project"
    }



  • Admob's working now. http://firebase.google.com (as far as I know, a couple of days ago, you're gonna turn on SDK. https://firebase.google.com/docs/android/setup Instructions. And https://firebase.google.com/docs/admob/android/quick-start admob.

    For example:

    Project-level build.gradle

    dependencies {
            ...
            classpath 'com.google.gms:google-services:3.0.0'
        }
    

    App-level build.gradle

    ...
        dependencies {
               ...
               compile 'com.google.firebase:firebase-core:9.2.0'
               compile 'com.google.firebase:firebase-ads:9.2.0'
            }
    ...
    

    apply plugin: 'com.google.gms.google-services'

    Pressure. Sync Nowfor synchronization. And then as usual.

    And look at the firebase, there's a lot of things in the same place.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2