Android Studio 3.0

I have written this. Maybe it works for you.
Did you look at this page?