Android: How to add R.raw to project?

后端 未结 13 1379
半阙折子戏
半阙折子戏 2021-02-04 23:39

How I could add R.raw class to my android project? Now I haven\'t /res/raw folder at all (and class as well). And I can\'t find any tools in eclipse to do that. So how to add R.

相关标签:
13条回答
  • 2021-02-05 00:13

    If you have a res/raw folder, be sure to add a file with a valid filename, otherwise the entire folder won't show up in the R class. If there's an error with a filename, it will appear in red in the console.

    0 讨论(0)
  • 2021-02-05 00:14

    Try putting a + before R.xyz. That should start showing additional folders, e.g.:

    + R.raw.beep.mp3
    
    0 讨论(0)
  • 2021-02-05 00:17

    enter image description hereRight click on package or Res folder click on new on popup then click on android resource directory

    a new window will be appear change the resource type to raw and hit OK copy and past song to raw folder remember don't drag and drop song file to raw folder and song spell should be in lower case! This method is for Android Studio Also Check MY Link

    0 讨论(0)
  • 2021-02-05 00:19

    Adding a raw folder to your resource folder (/res/) should do the trick.

    Read more here: https://developer.android.com/guide/topics/resources/providing-resources.html

    0 讨论(0)
  • 2021-02-05 00:24

    You may have to restart android studio if above solutions aren't working, i restarted it and then it works.

    0 讨论(0)
  • 2021-02-05 00:29

    Using IntelliJ Idea:

    1) Invalidate Caches, and 2) right click on resources, New Resources directory, type = raw 3) build

    note in step 2: I was concerned that simply adding a raw directory wouldn't be enough...

    0 讨论(0)
提交回复
热议问题