Arrow not appearing in R.java after being copied

#1

I am stuck on the adding resources section of chapter 2.

I am currently working in android studio instead of eclipse.

After dragging and dropping the arrow_left and arrow_right files from the solutions I am unable to find them in R.java, like the book says I will be able to.
In fact a ctrl+F search in R.java yields no results for R.drawable at all.

Without these resource ID’s the code in activity_quiz.xml : android:drawableRight="@drawable/arrow_right" is an error and the arrow isn’t added to the next_button.

Any help/insight would be greatly appreciated!

#2

I had the same problem. What I was doing wrong was pasting the drawable-hdpi, -mdpi, and -xhdpi folders directly in the drawable folder in my computer’s folder explorer. To fix it I pasted the drawable-hdpi, -mhdpi, and xhdpi folders in the same directory as the drawable folder itself, just like the mipmap folders are set up. Once I did that the folders popped up under drawable in android studio and my code worked just fine.

Hope this helps!

#3

Thank you Arshook. I am also using Android Studio and had the same question. Extracting the \02_MVC\GeoQuiz\res\drawable-* folders from the AndroidProgramming.zip and into the project “res” directory rather than the “res\drawable” directory did the trick. I selected “res” in Android Studio, then “Synchronize res” from the context menu and the icon .pngs appeared in the project.

After a build, the new icon resources appeared in R.Java, or .\AndroidStudioProjects\GeoQuiz\app\build\generated\source\r\debug\com\android<user>\geoquiz\R.java to be precise. Yay.