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

R.layout.activity (R symbol cannot be resolved) ?????

Hello Im new into Android Dev. having issues with R.layout.activity, R symbol cannot be resolved. Someone please help. Thanks!

5 Answers

I ran into this issue before, and the way I solved it is to clean the project.

From Android Studio, go to File > Invalidate caches / Restart and then Invalidate and Restart

let me know if that work for you?

It look like @+id/name is missing. Look at you activity_something.xml file which is under layout folder and see if there any error. Make sure id is tag is look like this - android:id="@+id/passwordField"

    <Button
        android:id="@+id/loginButton"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/passwordField"
        android:layout_alignStart="@+id/passwordField"
        android:layout_below="@+id/passwordField"
        android:text="@string/login_button_label" />

Works like a charm.... Thanks bro!

But now having more problems:

Error:(1) Resource id cannot be an empty string (at 'id' with value '@+id/'). Error:Execution failed for task ':app:processDebugResources'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/mastechs/Library/Android/sdk/build-tools/23.0.0/aapt'' finished with non-zero exit value 1

?????

Great! I have so much to learn... Thanks brother!