Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


activity_main cannot be resolved or is not a fiel

i keep receiving that error . here is my Main activity package com.example.magicball;

import android.R; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.TextView;

public class MainActivity extends Activity { private crystallball mcrystallball = new crystallball(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list_item); final TextView answerLabel = (TextView) findViewById(R.id.textView1); Button getAnswerButton = (Button) findViewById(R.id.button1); getAnswerButton.setOnClickListener(new View.OnClickListener() {

    public void onClick(View arg0) {
    String answer = mcrystallball.getAnAnswer();


public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;

} Maybe it has something to do with my layout, here is the code
<TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:textSize="32sp" />

    android:text="tell me" />

1 Answer

Rafael Moreno
Rafael Moreno
16,382 Points

That happened to me, add it to your R.java file. Just hover over the error message and the intellisense will pop up with that option.