I had a similar problem, for me in the end there was a typo in my AndroidManifest.xml file, specifically in the package name, I had an extra period in there. the compiler didn't pick up on it. It took me a long time to find this typo as nothing in the error logs pointed me that way, it just kept telling me it couldn't resolve R. It was a hard one to debug.
On Thursday, September 8, 2016 at 8:55:59 AM UTC-7, Albert Muñoz wrote: > > I'm doing on UDACITY the android development for begginers course and in > one exercice we must put this code o the activity_main.xml: > > > <?xml version="1.0" encoding="utf-8"?> > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" > xmlns:tools="http://schemas.android.com/tools" > android:orientation="vertical" > android:layout_width="match_parent" > android:layout_height="match_parent" > android:paddingBottom="@dimen/activity_vertical_margin" > android:paddingLeft="@dimen/activity_horizontal_margin" > android:paddingRight="@dimen/activity_horizontal_margin" > android:paddingTop="@dimen/activity_vertical_margin" > tools:context="com.example.android.justjava.MainActivity"> > > <TextView > android:id="@+id/quantity" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:text="Quantity" > android:textAllCaps="true"/> > <TextView > android:id="@+id/number_quantity" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:text="0" > android:textColor="#000000" > android:textSize="16sp" > android:paddingTop="16dp" > android:paddingBottom="16dp"/> > <Button > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:text="ORDER" > android:OneClick="submitOrder" > > /> > </LinearLayout> > > > > > > > > > > > > and on the MainActivity.java this code: > > > > > > > > > /** > > * Add your package below. Package name can be found in the project's > AndroidManifest.xml file. > > * This is the package name our example uses: > > * > > * package com.example.android.justjava; > > */ > > > > import android.os.Bundle; > > import android.support.v7.app.AppCompatActivity; > > import android.view.View; > > import android.widget.TextView; > > > /** > > * This app displays an order form to order coffee. > > */ > > public class MainActivity extends AppCompatActivity { > > > > @Override > > protected void onCreate(Bundle savedInstanceState) { > > super.onCreate(savedInstanceState); > > setContentView(R.layout.activity_main); > > } > > > > /** > > * This method is called when the order button is clicked. > > */ > > public void submitOrder(View view) { > > display(1); > > } > > > /** > > * This method displays the given quantity value on the screen. > > */ > > private void display(int number) { > > TextView quantityTextView = (TextView) > findViewById(R.id.quantity_text_view); > > quantityTextView.setText("" + number); > > } > > } > > > > > > > > And on the MainActivity.java code the R is in red and i don't understand > why??? > > I've tryed to clean the project, build the project and changing the code but > i cannot resolve the problem. > > Please HELP ME!!!!! > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/b2eab2ca-aa1d-42ac-ba80-dfb2cf20729b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

