The "OK Google" voice command first came to fruition on the Nexus 5, but it's since made its way across the Google product portfolio. It's especially useful on Android Auto, where it enables drivers to interact with their head units without getting too distracted. Unfortunately, it's currently broken and requires a workaround.
Loads of users are reporting this issue in the Google Product Forums' Android Auto User Community. Many are also suggesting fixes they've found, but they're not reliable. Thankfully, someone from the Android Auto team has stepped in to inform everyone that it's an issue with version 7.4 of the Google app, and that a fix is being worked on.
It's unclear when the fix will arrive, but it shouldn't take long. In the meantime, you can follow the steps above if you need a quick workaround.
Source : http://www.androidpolice.com/2017/06/30/ok-google-voice-command-broken-android-auto-fix-coming-soon/