0

I need to know where i have to get the google-play-services-ads.jar to include it in my project, so the ADMob banner can work fine.

Can everyone help me?

I'm implementing ADMob using this guide:

Gluon mobile cross-platform adsView

Thanks in advance

FFdeveloper
  • 241
  • 3
  • 14
  • What has changed from this [question](https://stackoverflow.com/questions/44542177/googles-admob-library-integration-import-cannot-be-resolved-in-javafx?noredirect=1&lq=1)? – José Pereda Jun 29 '17 at 12:46
  • I need to know where i can find that jar, for all the rest it seems to work. I think was appropriate to open another question instead. But if you think is better i can close this question and write in the chat of that question – FFdeveloper Jun 29 '17 at 12:49
  • No, it's ok, the jar is bundled in an`.aar` file, here: `/extras/google/m2repository/com/google/android/gms/play-services-ads//play-services-ads-.aar`. If you added `explodeAarDependencies` to your build, you should find inside that folder the `exploded` one with the jar file. – José Pereda Jun 29 '17 at 13:22
  • I've got this in the build.gradle: project.afterEvaluate { explodeAarDependencies(project.configurations.androidCompile) } And i've added to the classpath the path to play-se‌​rvices-ads-‌​.aar. Is that right? Where i should find the .jar? – FFdeveloper Jun 29 '17 at 13:31
  • When you run the `android` task, `explodeAarDependencies` should be called, and it will find the .aar file, extracting the jar from it. You can do it manually (.aar is like a zip), and copy the jar to the project, if the task doesn't work for you. – José Pereda Jun 29 '17 at 14:06
  • I've done that task but i can't find that jar. Where i should find the .jar? – FFdeveloper Jun 29 '17 at 14:17
  • Under `/extras/google/m2repository/com/google/android‌​/gms/play-services-a‌​ds//exploded/play-se‌​rvices-ads-‌​.jar` – José Pereda Jun 29 '17 at 14:18
  • There's no exp‌​loded folder in there. Where i went wrong with this? – FFdeveloper Jun 29 '17 at 14:20
  • Run the task with `--info`, and see if there has been any error in the process – José Pereda Jun 29 '17 at 14:22
  • This: /extras/google/m2repository/com/google/android‌​‌​/gms/play-services‌​-a‌​ds//exp‌​loded/play-se‌​rvice‌​s-ads-‌​.ja‌​r was right, i made a mistake. If you can post this as the answer i'll be glad to mark it as answer. Thanks you so much – FFdeveloper Jun 29 '17 at 14:31

1 Answers1

1

Google has a local repository where you can find Google Play Services dependencies. For ads, you can find the .aar file under:

<ANDROID_HOME>/extras/google/m2repository/com/google/android‌​/gms/play-services-a‌​ds/<version>/play-se‌​rvices-ads-<version>‌​.aar

where ANDROID_HOME has been added to the gradle.properties file, with the path to the Android SDK, and <version> should be replaced with the number of ads version, i.e. 9.4.0.

Adding explodeAarDependencies to your build.gradle file takes care of finding that aar file, and extracting the jar and other required files, into an exploded folder:

 <ANDROID_HOME>/extras/google/m2repository/com/google/android‌​/gms/play-services-a‌​ds/<version>/exploded/play-se‌​rvices-ads-<version>‌​.jar

You can find more about that task here.

José Pereda
  • 44,311
  • 7
  • 104
  • 132