title: IllegalArgumentException when app start post backpressed
body: <p>I use &quot;by viewModels&quot; kotlin delegate for get some view model:</p>
  <pre><code>val viewModelFactory: ViewModelFactory by lazy { ViewModelFactory.getInstance(this) }
  
  val mainViewModel: MainViewModel by viewModels { viewModelFactory }
  </code></pre>
  <p>ViewModelFactory:</p>
  <pre><code>class ViewModelFactory private constructor(activity: AppCompatActivity) : AbstractSavedStateViewModelFactory(activity, null) {
  private val application = activity.application
  
  // DataSource
  private val appDataSource: AppDataSourceImpl by lazy { AppDataSourceImpl(application) }
  
  // Intercator 
  private val appDataInteractor: AppDataInteractor by lazy {
      AppDataInteractor(appDataSource, userDataSource)
  }
  
  companion object {
      private var instance: ViewModelFactory? = null
      fun getInstance(activity: AppCompatActivity): ViewModelFactory {
          return instance ?: ViewModelFactory(activity).also {
              instance = it
          }
      }
  }
  
  override fun &lt;T : ViewModel&gt; create(
      key: String,
      modelClass: Class&lt;T&gt;,
      handle: SavedStateHandle
  ): T {
      return when {
          MainViewModel::class.java.isAssignableFrom(modelClass) -&gt; {
              modelClass.getConstructor(AppDataInteractor::class.java, SavedStateHandle::class.java)
                 .newInstance(appDataInteractor, handle)
          }
          else -&gt; throw Exception(&quot;Unknown ViewModel $modelClass&quot;)
      }
  }
  
  }
  </code></pre>
  <p>When app was closed by backpressed and launched again, it throws exception &quot;java.lang.IllegalArgumentException: SavedStateProvider with the given key is already registered.&quot;</p>
  <p>I see two solutions to resolve the problem.
  First is use exitProcess() instead of super.onBackPressed(). It is worked.</p>
  <pre><code>    override fun onBackPressed() {
          if (drawerLayout.isOpen) drawerLayout.close()
          else {
              if (navController.currentDestination?.id == R.id.nav_homeFragment) {
              exitProcess(1) //super.onBackPressed()
             }
          else navController.navigateUp()
       }
      }
  </code></pre>
  <p>Second is transfer my viewmodel from activity to application. In the case there are survive after destroying activity. But i can`t use &quot;by viewModels&quot; kotlin delegate in application. I think it is not right solution (but it work too).</p>
  <p>Where is the right way to get viewmodels?</p>