2

I'm having some issues with an Android-Chromecast sender app. I'm using Android Studio (with Proguard enabled for debug), I imported the required libraries in Gradle

compile 'com.android.support:appcompat-v7:22.+'
compile 'com.android.support:mediarouter-v7:22.+'
compile 'com.google.android.gms:play-services:7.0.0'

and then added "android.support.v7.app.MediaRouteButton" to my layout:

<android.support.v7.app.MediaRouteButton
android:id="@+id/media_route_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:mediaRouteTypes="user"
android:visibility="gone" />

I can use all the methods and objects from the MediaRouter library in my Activity but when I run the app it crash trying to load the MediaRouteButton from the layout. Anyone know what is the problem?

Thank you in advance

Alberto Méndez
  • 1,044
  • 14
  • 31
  • 1
    I solved it by setting the app theme to an Appcompat theme and adding the parameter "android:background="@android:color/transparent" " to the MediaRouteButton element in the layout. But now I'm getting an error after trying to re open the route selector dialog when Chromecast is connected and receiver has been launched. The error is "Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x7f0100a1 a=-1}" – Alberto Méndez Apr 06 '15 at 10:43
  • 1
    The problem here was in the AndroidManifest.xml I had "@style/Theme.NoTitle" instead of "@style/AppTheme" – Alberto Méndez Apr 06 '15 at 14:45
  • 1
    Just adding the android:background="@android:color/transparent" attribute to my MediaRouteButton element fixes the issue for me. – Lo-Tan May 01 '15 at 20:49

0 Answers0