R cannot be resolved to a variable: Chromecast example

I am trying to run the following project that I cloned with a Git hub: https://github.com/googlecast/CastHelloText-android .

For some reason, even after several cleanings and building and reloading the project, I get the following error:

R cannot be resolved by a variable .


Found the culprit in the provided manifest file.

No resources were found, which matches the name:

android:value="@integer/google_play_services_version" 
android:theme="@style/Theme.AppCompat" 

and the provided menu.xml

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto" >

    <item
        android:id="@+id/media_route_menu_item"
        android:title="@string/media_route_menu_title"
        app:actionProviderClass="android.support.v7.app.MediaRouteActionProvider"
        app:s="always"/>

</menu>

Resource ID not found for attribute "actionProviderClass" in package "com.example.casthelloworld"

Resource ID not found for attribute 'showAsAction' in package 'com.example.casthelloworld'


Import

import com.example.casthelloworld.R;
import android.content.Intent;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.speech.RecognizerIntent;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.MediaRouteActionProvider;
import android.support.v7.media.MediaRouteSelector;
import android.support.v7.media.MediaRouter;
import android.support.v7.media.MediaRouter.RouteInfo;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

import com.google.android.gms.cast.ApplicationMetadata;
import com.google.android.gms.cast.Cast;
import com.google.android.gms.cast.Cast.ApplicationConnectionResult;
import com.google.android.gms.cast.Cast.MessageReceivedCallback;
import com.google.android.gms.cast.CastDevice;
import com.google.android.gms.cast.CastMediaControlIntent;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.common.api.Status;
+4
1

, XML ( ), "" "" ).

+2

Source: https://habr.com/ru/post/1526985/


All Articles