title: How to avoid Duplicate finish request for ActivityRecord
body: <p>From LoginActivity after successful login app goes to the MainActivity. When I click the back button i get this warning.</p>
  
  <pre><code>W/ActivityManager: Duplicate finish request for ActivityRecord
  </code></pre>
  
  <p>And when I start the app again LoginActivity is called again.</p>
  
  <p>After successful login I call</p>
  
  <pre><code>Intent intent = new Intent(this, HomeActivity.class);
      intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_CLEAR_TASK);
      startActivity(intent);
      finish();
  </code></pre>
  
  <p>The problem is only in the release build.</p>