3

We ran into a problem and cannot add Google Play Services lib to our application.

The problem is that the lib introduces 24,000 methods and a single dex can only contain 65536 methods.

Is there a way to get the Google Advertising ID without a reference to Google Play Services?

Mike Bonnell
  • 16,181
  • 3
  • 61
  • 77
Avia
  • 1,829
  • 2
  • 14
  • 15
  • 1
    Duplicate question, here is your answer http://stackoverflow.com/questions/20097506/using-the-new-android-advertiser-id-inside-an-sdk – Nathan Schwermann Sep 26 '14 at 15:06

3 Answers3

4

As of Google Play Services 7.0.0 Release 23 you can now choose to only include the parts of Google Play Services you need.

In this case in your gradle file:

compile 'com.google.android.gms:play-services-ads:7.0.0'

That will drastically reduce the number of methods which are added.

Madhava Jay
  • 732
  • 1
  • 5
  • 14
0

No, there's no documented API, other than Google Play Services, to retrieve the advertising ID. You could try to use Proguard to strip unneeded packages from Google Play Services to reduce method references, but obviously be very careful of what you strip as you'll run into NoClassDefFound exceptions if you strip required classes/packages.

Sam Dozor
  • 40,335
  • 6
  • 42
  • 42
-1

No you can't , Only Google Powered Devices can get AdvertisingIdClient , if your Targeting a Non-Google Devices then , try using other Ad-services..

Rajesh Mikkilineni
  • 854
  • 10
  • 22