quantcast / android-measurement

Quantcast Measure for Android
13 stars 12 forks source link

Quantcast 1.2.6 includes GMS inappropriately #11

Closed dlew closed 9 years ago

dlew commented 9 years ago

Not sure exactly what's going on, but upgrading from 1.2.5 -> 1.2.6 yields this error in our build process:

Execution failed for task ':trello-app:processGoogleReleaseResources'.
> Error: more than one library with package name 'com.google.android.gms'
  You can temporarily disable this error with android.enforceUniquePackageName=false
  However, this is temporary and will be enforced in 1.0
SmithKevin commented 9 years ago

The 1.2.6 version of the SDK uses the split versions of play services. That way in order to include the Quantcast SDK you don't need to pull in a bunch of unneeded play methods. You can read more about that here: http://developer.android.com/google/play-services/setup.html#split

So this error is happening because you are including the full google play library in your build.gradle file.
Basically it contains a line similar this:

compile 'com.google.android.gms:play-services:6.5.+'

Instead of including the entire play library, you should instead just pick the pieces of the Google Play services that the application actually needs.

This is a pretty big adjustment from how it worked previously, but I feel that this is the future direction of the Play Services library and it keep people from reaching the dreaded 65,536 method limit. For now, we will create another library that depends on the full play services library in order to work with both ways. The documentation will also be updated to reflect these changes.

dlew commented 9 years ago

Ah, so it's a version clash. We're on the old version primarily because of some bugs with the initial 6.5 release.

We'll just hold off until the latest GMS is more stable.

dlew commented 9 years ago

I'm re-opening this because I tried updating to GMS 6.5 there are still build issues with Quantcast, and I'm having even more than before. Here's a list of what works and what doesn't:

  1. QC 1.2.5 + GMS 6.1 == Success
  2. QC 1.2.5 + GMS 6.5 == Success
  3. QC 1.2.5 + GMS 6.5 (individual dependencies) == Failure
  4. QC 1.2.6 + GMS 6.1 == Failure
  5. QC 1.2.6 + GMS 6.5 == Failure
  6. QC 1.2.6 (split) + GMS 6.5 (individual dependencies) == Failure

In other words - I can only get QC 1.2.5 to build, and only if I include the full GMS library.

Every time it's the same error (the original one I posted above).

SmithKevin commented 9 years ago

I have been looking into this the last few days and it looks to be an issue with the new default JCenter repository that android is using. I have been uploading to Maven Central and then JCenter looks to sync from that. However for some reason JCenter is not pulling the updated 1.2.6 libraries. For me if I use mavenCentral() then cases 4-6 work fine. In Jcenter, Case 6 seems to be working for me currently with the following dependancies using Jcenter:

compile 'com.quantcast.android.measurement:QuantcastAndroidSdk-split:1.2.6' compile 'com.google.android.gms:play-services-ads:6.5.+'

But this wouldn't work if you have another dependency pulling in the full google play library, so maybe thats why its not working for you.

I have a support email in with the JCenter people, but it might just be easier for me to upload a new 1.2.7 version to JCenter directly which would be my last resort. Thanks for the update and I'll post back when I get something working.

dlew commented 9 years ago

Aha! I figured out there's a mistake I made in my own code. I was accidentally still including the full GMS in addition to the individual versions. Thank goodness for gradle dependencies.

That still doesn't solve the full vs. partial, but I can get case 6 to work now (which is the ideal case anyways).

SmithKevin commented 9 years ago

OK I think this is finally solved for all cases using version 1.2.6. Both ways should now work using both mavenCentral() and jcenter()

compile 'com.quantcast.android.measurement:QuantcastAndroidSdk-split:1.2.6' compile 'com.google.android.gms:play-services-ads:6.5.+'

OR

compile 'com.quantcast.android.measurement:QuantcastAndroidSdk:1.2.6' compile 'com.google.android.gms:play-services:6.5.+'

If you are still getting the above error, be sure to used the --refresh-dependencies flag in order to force gradle to not use its local cache. Please let me know if anyone is still having issues.