Android: Cast SDK v3 CastOptionsProvider not detected in release build
<p>I've correctly declared CastOptiponsProvider manifest.xml</p>

<pre><code>        &lt;meta-data
        android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
        android:value="org.lao.yao.kd.cast.CastOptionsProvider" /&gt;
</code></pre>

<p>Anyway I got this error message only when I build app for release:</p>

<pre><code>java.lang.ClassNotFoundException: org.lao.yao.kd.cast.CastOptionsProvider
</code></pre>

<p>Thi is my CastOptionsProvider class:</p>

<pre><code>public class CastOptionsProvider implements OptionsProvider {

@Override
public CastOptions getCastOptions(Context context) {
    NotificationOptions notificationOptions = new NotificationOptions.Builder()
            .setActions(Arrays.asList(MediaIntentReceiver.ACTION_SKIP_NEXT,
                    MediaIntentReceiver.ACTION_TOGGLE_PLAYBACK,
                    MediaIntentReceiver.ACTION_STOP_CASTING), new int[]{1, 2})
            .setTargetActivityClassName(ExpandedControlsActivity.class.getName())
            .build();
    CastMediaOptions mediaOptions = new CastMediaOptions.Builder()
            .setImagePicker(new ImagePickerImpl())
            .setNotificationOptions(notificationOptions)
            .setExpandedControllerActivityClassName(ExpandedControlsActivity.class.getName())
            .build();
    return new CastOptions.Builder()
            .setReceiverApplicationId(MyJsonConfig.getPrefString(MyJsonConfig.KEY_CHROMECAST_RECEIVER_ID, context) )
            .setCastMediaOptions(mediaOptions)
            .build();
}

@Override
public List&lt;SessionProvider&gt; getAdditionalSessionProviders(Context appContext) {
    return null;
}

private static class ImagePickerImpl extends ImagePicker {

    @Override
    public WebImage onPickImage(MediaMetadata mediaMetadata, int type) {
        if ((mediaMetadata == null) || !mediaMetadata.hasImages()) {
            return null;
        }
        List&lt;WebImage&gt; images = mediaMetadata.getImages();
        if (images.size() == 1) {
            return images.get(0);
        } else {
            if (type == ImagePicker.IMAGE_TYPE_MEDIA_ROUTE_CONTROLLER_DIALOG_BACKGROUND) {
                return images.get(0);
            } else {
                return images.get(1);
            }
        }
    }
}
</code></pre>

<p>}</p>

<p>I also use proguard for my release build. </p>