title: Android Auto Dekstop Head Unit ANR: GET_APP_VERSION
body: <p>I'm sitting with an app and want to try it out for Android Auto. Im using the DHU for emulating the dashboard, but I'm not able to see the layout due to an ANR (Application not responding) error.</p>
  <p><a href="https://i.stack.imgur.com/lFvsk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lFvsk.png" alt="enter image description here" /></a></p>
  <p>I do get one error in the logcat, but I'm unsure if its related to this:</p>
  <pre><code>2021-03-04 15:36:07.654 19595-19616/com.ooono.app W/Binder: Caught a RuntimeException from the binder stub implementation.
      java.lang.SecurityException: Binder invocation to an incorrect interface
          at android.os.Parcel.nativeEnforceInterface(Native Method)
          at android.os.Parcel.enforceInterface(Parcel.java:650)
          at androidx.car.app.ICarApp$Stub.onTransact(ICarApp.java:207)
          at android.os.Binder.execTransactInternal(Binder.java:1159)
          at android.os.Binder.execTransact(Binder.java:1123)
  </code></pre>
  <p>My code is basically this</p>
  <pre><code>import android.content.Intent
  import android.content.pm.ApplicationInfo
  import androidx.car.app.*
  import androidx.car.app.model.*
  import androidx.car.app.navigation.model.NavigationTemplate
  import androidx.car.app.validation.HostValidator
  
  class CarActivity : CarAppService() {
  
      override fun createHostValidator(): HostValidator {
          return if (applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE !== 0) {
              HostValidator.ALLOW_ALL_HOSTS_VALIDATOR
          } else {
              HostValidator.Builder(this)
                      .addAllowedHosts(R.array.hosts_allowlist_sample)
                      .build()
          }
      }
  
      override fun onCreateSession(): Session {
          return object : Session(){
              override fun onCreateScreen(intent: Intent): Screen {
                  return NavScreen(carContext)
              }
          }
      }
  
      class NavScreen(carContext: CarContext) : Screen(carContext){
          override fun onGetTemplate(): Template {
              val listTemplate = ListTemplate.Builder().apply {
                  addSectionedList(SectionedItemList.create(
                          ItemList.Builder()
                                  .addItem(Row.Builder().setTitle(&quot;list 1&quot;).addText(&quot;hellowrodl&quot;).build())
                                  .build(),&quot;List&quot;
                  ))
              }
  
              return listTemplate.build()
          }
  
          private fun actionStrip():ActionStrip{
              val strip = ActionStrip.Builder().apply {
                  addAction(Action.Builder().setIcon(CarIcon.APP_ICON).setTitle(&quot;Ooono&quot;).setOnClickListener { }.build())
              }.build()
              return strip
          }
      }
  }
  
  </code></pre>
  <p>and I've added the necessay tags to the manifest:</p>
  <pre><code>&lt;meta-data
              android:name=&quot;com.google.android.gms.car.application&quot;
              android:resource=&quot;@xml/automotive_app_desc&quot; /&gt;
  
  
  &lt;service
              android:name=&quot;.aa.CarActivity&quot;
              android:label=&quot;@string/common_app_name&quot;
              android:icon=&quot;@mipmap/ic_launcher&quot;
              android:foregroundServiceType=&quot;location&quot;
              android:exported=&quot;true&quot;&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name=&quot;androidx.car.app.CarAppService&quot;/&gt;
                  &lt;category android:name=&quot;androidx.car.app.category.NAVIGATION&quot;/&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
  </code></pre>