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 Build a Simple Android App (2014) Creating the Screen Layout Adding a Button

Got an error of Error:(21, 37) error: ';' expected

This is the error I got after I run the code C:\Users\tayal\AndroidStudioProjects\FunFacts3\app\build\generated\source\r\debug\com\akash\tayal\funfacts\R.java Error:(21, 37) error: ';' expected Error:Execution failed for task ':app:compileDebugJava'.

Compilation failed; see the compiler error output for details.

Sean Do
Sean Do
11,933 Points

Check what Nicolas Hampton said, but if you're still having trouble finding it. Copy & Paste your code here.

2 Answers

Seth Kroger
Seth Kroger
56,413 Points

Nicholas' answer if pretty much right but R.java is a file that Android Studio is supposed to generate automatically for you. Go the top menu on Android Studio and select Build -> Clean Project and rebuild. If you still have problems check the .xml files in res for errors.

You're missing a semicolon at the end of one of your lines of code. Go through and look for a line that should be closed with one, there's one missing.