0

We have a very simple java SDK that can be imported in any android APP to do some basic tasks. One of the functionality of this SDK is to read the AAID, so we depend on Google-Play-Services.

Our current approach is use gradle java plugin and add the play-services.jar as a dependancy to our project. The latest versions of the google-play-services are packaged as .aar. So I need to know if there is any efficient way to do this or extract the aar and add the classes.jar as dependancy. While that will still work but I feel the entire solution is hacky.

I need to know what is the right way to get this done?

Thanks

Karthik
  • 315
  • 1
  • 4
  • 17
  • 2
    The efficient way is to add play service as a dependency in gradle because if you add a jar file it would lead to issues when you want to update google play services to its latest version while updating play services sdk in gradle is hassle free – SaravInfern Aug 03 '16 at 05:38
  • How can I add this dependancy in gradle? I tried to compile them and it compiles successfully. But my build fails in `:compileJava` task, as this the compiled output is not available and it fails with `package not found` error. Can you elaborate on your answer? – Karthik Aug 03 '16 at 05:48
  • can you post your log cat what is the error you get – SaravInfern Aug 03 '16 at 05:49
  • I tried, `compile (name:'play-services-basement/9.4.0/play-services-basement-9.4.0', ext:'aar')`. It compiles successfully but fails in `:compileJava` with package not found. `:compileJava (Thread[main,5,main]) started. :compileJava Executing task ':compileJava' (up-to-date check took 0.143 secs) due to: package com.google.android.gms.ads.identifier does not exist import com.google.android.gms.ads.identifier.AdvertisingIdClient;` I made sure to check the `play-services-basement` and it does contain the required `AdvertisingIdClient` class. – Karthik Aug 03 '16 at 05:55
  • Have you configured java jdk location in your android studio (I hope you are using android studio) setting, if not try to compile after adding this may be the issue – SaravInfern Aug 03 '16 at 06:02
  • Yes. It is configured correctly. I check using `--debug` option during `gradle build`. The `play-services-basement-9.4.0.aar` is in the classpath. Yet the java compiler can't access the `classes.jar` inside the aar file. Any suggestions? – Karthik Aug 03 '16 at 06:45

0 Answers0