0

(This is basically the same question as in Android: library project with Retrofit results in NoClassDefFoundError but for play-services-auth).


I'm trying to build an android library project which uses play-services-auth to access SmartLock for Passwords.

It seems to be working as long as I use api instead of implementation on my gradle-dependency for com.google.android.gms:play-services-auth. It seems that this is the only dependency needing this (all others can used with implementation).

When using implementation here as well, the calling app will crash with NoClassDefFoundError:

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/api/GoogleApiClient$Builder;


I'm using consumerProguardFiles with a bunch of proguard-rule-files (e.g. one for okhttp3, retrofit2 etc. from this repo). All this will then be packed into an AAR, so rules from the dependencies should be added as well.

It seems that I'm missing a proguard-rule for play-services-auth. Can somebody post the rules needed to use com.google.android.gms:play-services-auth in a library project?

hardysim
  • 2,756
  • 2
  • 25
  • 52
  • Does it work if you disable proguard? – dazza5000 Feb 28 '18 at 13:40
  • Hmm, maybe proguard is the wrong keyword. Actually the problem lies in the use of `implementation` over `api`. So dependencies will not be exposed to consumers. See https://stackoverflow.com/a/44493379/2170109. But I don't get why I need to expose `play-services-auth` to consumers of my library when only the library calls SmartLock-features? – hardysim Feb 28 '18 at 14:11
  • Did your change fix it? – dazza5000 Feb 28 '18 at 14:48
  • No, no solution yet. I've just realized that it has nothing to do with proguard. But I still don't know why I need to expose `play-services-auth` outside my library. – hardysim Mar 01 '18 at 06:57

0 Answers0