This is a new feature from Android Studio 3.0. When you execute any gradle command by pressing 'Run' button in Android Studio, it adds testOnly=true flag to your manifest.
To eliminate this issue just execute assembleRelease from Gradle pane on the right side of Android Studio.