title: Google Auth migrating to androidx: SignInHubActivity does not implement Lifecycle
body: <p>After the migration to AndroidX i'am facing this the following issue with the Google Auth lib:</p>
  
  <p>On Android 9 API 28:</p>
  
  <pre><code>java.lang.IncompatibleClassChangeError: Class 'com.google.android.gms.auth.api.signin.internal.SignInHubActivity' does not implement interface 'androidx.lifecycle.LifecycleOwner' in call to 'androidx.lifecycle.Lifecycle androidx.lifecycle.LifecycleOwner.getLifecycle()' (declaration of 'androidx.lifecycle.LiveData' appears in /data/app/fourbottles.bsg.workinghours4b-G1onPKgFFE-l3aqjx0qDJw==/split_lib_dependencies_apk.apk)
      at androidx.lifecycle.LiveData.observe(LiveData.java:172)
      at androidx.loader.app.LoaderManagerImpl$LoaderInfo.setCallback(LoaderManagerImpl.java:100)
      at androidx.loader.app.LoaderManagerImpl.createAndInstallLoader(LoaderManagerImpl.java:400)
      at androidx.loader.app.LoaderManagerImpl.initLoader(LoaderManagerImpl.java:421)
      at com.google.android.gms.auth.api.signin.internal.SignInHubActivity.zzn(Unknown Source:80)
      at com.google.android.gms.auth.api.signin.internal.SignInHubActivity.onActivityResult(Unknown Source:68)
      at android.app.Activity.dispatchActivityResult(Activity.java:7454)
      at android.app.ActivityThread.deliverResults(ActivityThread.java:4353)
      at android.app.ActivityThread.handleSendResult(ActivityThread.java:4402)
      at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
      at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
      at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
      at android.os.Handler.dispatchMessage(Handler.java:106)
      at android.os.Looper.loop(Looper.java:193)
      at android.app.ActivityThread.main(ActivityThread.java:6669)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
  </code></pre>
  
  <p>On Android 5.0.2 API 22</p>
  
  <pre><code>Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'androidx.lifecycle.Lifecycle$State androidx.lifecycle.Lifecycle.getCurrentState()' on a null object reference
      at androidx.lifecycle.LiveData.observe(LiveData.java:172)
      at androidx.loader.app.LoaderManagerImpl$LoaderInfo.setCallback(LoaderManagerImpl.java:100)
      at androidx.loader.app.LoaderManagerImpl.createAndInstallLoader(LoaderManagerImpl.java:400)
      at androidx.loader.app.LoaderManagerImpl.initLoader(LoaderManagerImpl.java:421)
      at com.google.android.gms.auth.api.signin.internal.SignInHubActivity.zzn(Unknown Source)
      at com.google.android.gms.auth.api.signin.internal.SignInHubActivity.onActivityResult(Unknown Source)
      at android.app.Activity.dispatchActivityResult(Activity.java:6139)
      at android.app.ActivityThread.deliverResults(ActivityThread.java:3535)
      at android.app.ActivityThread.handleSendResult(ActivityThread.java:3582) 
      at android.app.ActivityThread.access$1300(ActivityThread.java:144) 
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1327) 
      at android.os.Handler.dispatchMessage(Handler.java:102) 
      at android.os.Looper.loop(Looper.java:135) 
      at android.app.ActivityThread.main(ActivityThread.java:5221) 
      at java.lang.reflect.Method.invoke(Native Method) 
      at java.lang.reflect.Method.invoke(Method.java:372) 
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
  </code></pre>
  
  <p>I'am using the following lib versions:</p>
  
  <pre><code>implementation 'com.google.android.gms:play-services-gcm:16.0.0'
  implementation 'com.google.android.gms:play-services-auth:16.0.1'
  implementation 'androidx.appcompat:appcompat:1.0.2'
  implementation 'androidx.multidex:multidex:2.0.1'
  </code></pre>
  
  <p>The code is crashing as soon as i start an activity with the intent:</p>
  
  <pre><code>val signInIntent = Auth.GoogleSignInApi.getSignInIntent(googleApiClient)
  startActivityForResult(signInIntent, LOGIN_WITH_GOOGLE_CODE)
  </code></pre>
  
  <p>I have the following properties into the settings.gradle file:</p>
  
  <pre><code>android.useAndroidX=true
  android.enableJetifier=true
  </code></pre>
  
  <p>The Google Auth lib doesn't support authentication with AndroidX libs?</p>
  
  <p>Is there a way to start an intent from an androidX lib with the supported lib behaviour?
   </p>
  
  <p>I accept answers in both java and kotlin languages.</p>
  
  <p>Update 1: 27.12.2017</p>
  
  <p>Google api client creation:</p>
  
  <pre><code> GoogleSignInOptions googleSignInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                  .requestIdToken(getString(R.string.default_web_client_id))
                  .requestEmail()
                  .build();
  
   googleApiClient = new GoogleApiClient.Builder(this)
                  .enableAutoManage(this, this)
                  .addApi(Auth.GOOGLE_SIGN_IN_API, googleSignInOptions)
                  .build();
  </code></pre>
  
  <p>It may be beacuse of <code>enableAutoManage</code> ?</p>
  
  <h2><strong>Update 2: 28.12.2018</strong></h2>
  
  <p>I managed to login with the following piece of code:</p>
  
  <pre><code>Task&lt;GoogleSignInAccount&gt; sign = googleSignInClient.silentSignIn();
  GoogleSignInAccount result = sign.getResult();
  </code></pre>
  
  <p>So i think there is no problem with the credentials or the other configuration files. In this way the user won't be able to choose an account.</p>
  
  <p>I think that Jetifier is failing in same way.</p>
  
  <p>With API 27 i'am getting the same error.</p>