2015-11-04 2 views
1

Je sais que cette question a déjà été répondue mais je les ai tous vérifiés et rien n'a fonctionné.Android Studio ne peut pas résoudre R

J'ai un projet simple qui ne peut pas résoudre le signe R pour une raison quelconque.

Code MainActivity

public void onCreate(Bundle savedInstanceState) 
     { super.onCreate(savedInstanceState); 
      setContentView(R.layout.activity_main); 
      editName = (EditText)findViewById(R.id.editname); 
      editCode =(EditText)findViewById(R.id.editcode); 
      bSearch=(Button)findViewById(R.id.bSearch); 
} 

activity_main Fichier

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    <TextView android:text="Ελληνικά Προϊόντα" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:textAlignment="center" 
     android:textSize="20dp" 
     android:layout_marginBottom="10dp"/> 
    <TextView android:text="Όνομα" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"/> 
    <EditText android:id="@+id/editname" 
     android:inputType="number" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"/> 
    <TextView android:text="Κωδικός Προϊόντος" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"/> 
    <EditText android:id="@+id/editcode" 
     android:inputType="number" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"/> 
    <Button android:id="@+id/bSearch" 
     android:text="Αναζητηση" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"/> 
</LinearLayout> 

Android Manifest Fichier

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.seth.greekproducts" > 
    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="GreekProducts" 
     android:supportsRtl="true" 
     android:theme="@style/AppTheme" > 
     <activity android:name=".MainActivity" > 
     </activity> 
    </application> 
</manifest> 

EDIT: à la console d'erreur que je reçois:

Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'. 

Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'. 

et des dizaines d'erreurs similaires.

EDIT: build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules. 

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:1.3.0' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 
task clean(type: Delete) { 
    delete rootProject.buildDir 
} 
+0

Importez-vous 'com.example.seth.greekprducts.R'? –

+0

@bigdestroyer Merci d'avoir répondu. Oui et le R est lu à l'importation aussi! –

+0

C'est une question trop ancienne –

Répondre

0

Je pense que vous avez obtenu cette erreur après avoir nettoyé la project.If vous avez des erreurs sur fichier xml, il affichera une erreur sur R.java. Donc, essayez de vérifier votre fichier xml a des erreurs.

+0

Je les ai vérifiés et je les ai postés ici aussi. Je ne peux pas trouver quelque chose de mal ..:/ –

0

Avec Android Studio, ce que vous avez à faire est généralement de cliquer sur Sync Project with Gradle Files.

C'est l'icône en haut à droite de votre écran, la 5ème à partir de la droite.

+0

J'ai essayé cela. Je reçois "