title: Android lifecycle library: Cannot add the same observer with different lifecycles
body: <p>I have an app I'm working on that's using the lifecycle library but I'm getting an IllegalArgumentException that says "Cannot add the same observer with different lifecycles" I only add observers in onCreate which I thought would be safe. Most of my observers are added via anonymous classes which I assume can't be the issue here since the observer is never recycled. One is using <code>this</code>:</p>
  
  <pre><code>private GpsState gpsState;
  
  void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      getLifecycle().addObserver(gpsState);
      gpsState.observe(this, (state) -&gt; {
          // ...
      });
  }
  </code></pre>
  
  <p>In this example <code>GpsState</code> extends <code>LiveData</code> to provide the current state of the GPS and implements <code>LifecycleObserver</code> to be able to refresh certain values when reaching an ON_RESUME state.</p>
  
  <p>Any idea what I might be doing wrong?</p>