Reference Android Sender w/ Framework API: CastVideos-android application shows how to cast videos from an Android device that is fully compliant with the Cast Design Checklist.
After Gradle v3.0.0+ 'enforceUniquePackageName' has been deprecated. You can either, not update the gradle, or remove that line. The app should build regardless.
I am using androidStudio-3.0. However, the following error occurs.