Ich weiß, dass diese Frage mehrmals gestellt wurde, aber keine Antworten sind aufgrund meines Kontextes nützlich. Die Sache ist, ich öffnete gerade mein erstes Projekt (in meinem tatsächlichen Computer) und ohne etwas zu bearbeiten, alles "R". in der mainActivity.java rot werden. Weiß jemand, was die Ursachen für dieses Problem sind und wie es behoben werden kann? HierAndroid Studio: kann Symbol "R" nicht auflösen
ist die .java Haupttätigkeit
package com.nico.calc_02;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
und dies ist die .xml Layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<TextView android:text="@string/hello_world" android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
Ich habe nicht den Code oder irgendetwas geändert. Ich verwende Android Studio. Weiß jemand, wie man es repariert?
Versuchen Sie, diese [Lösung] [1] kann Ihr Problem [1] lösen: http://stackoverflow.com/a/32119880/3343174 – Fakher
Versuchen Sie, diese [Lösung] [1] Es kann Ihr Problem lösen. [1]: http://stackoverflow.com/a/32119880/3343174 – Fakher