cannot resolve symbol R.raw

Raunak Pandey :

enter image description here

In the above screenshot you can clearly see that I have created a raw folder with two files but when I do R.raw it says "cannot resolve raw".

here's all of my import statements:

package com.raunak.alarmdemo4.Activities;

import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.content.pm.ActivityInfo;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import com.arbelkilani.clock.Clock;
import com.ebanx.swipebtn.OnStateChangeListener;
import com.ebanx.swipebtn.SwipeButton;
import com.raunak.alarmdemo4.HelperClasses.AlarmsDBhelperClass;
import com.raunak.alarmdemo4.R;
import java.io.IOException;
import java.util.Calendar;
import static com.raunak.alarmdemo4.R.*;
cod-e-rection :

Try cleaning your project and building again. If this not work :

  1. Remove the import for the R.symbol, because probably you have imported R.class in your file, then click on the imported file and press ALT + Enter.
  2. If this also doesn't work then access it like this : your.project.package.R.raw .file_name
  3. Also try to remove the capital letter from the name of your audio.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=33020&siteId=1