Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

error: package R does not exist!?

Hi, everytime i try to run my app i am just receiving the gradle build error - error: package R does not exist! Is there a way to solve this??

1 Answer

Hello,

I'm guessing you're breaking up your project into seperate packages. If so, you are going to need to import the R class(which is automatically generated when you build your project).

For example,

import com.example.R;

if your base package is com.example

Also, I beleive Android Studio does this automatically for you if its necessary if you run the optimize imports command.