3

Ich bin neu in Android Studio. Mein Projekt wird ausgeführt und ausgeführt, aber wenn ich auf activity_main.xml klicke, sehe ich Fehler, die ich nicht verstehe. Der Fehler istRendering-Probleme Die folgenden Klassen konnten nicht gefunden werden - android.support.v7.widget.AppCompatTextView

 Rendering Problems The following classes could not be found: 
- android.support.v7.widget.AppCompatTextView (Fix Build Path, Edit XML, Create Class) 

Mein activity_main.xml ist:

<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="fill_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" 
android:background="#5b9bd5"> 



<ImageButton 
    android:id="@+id/regiterbutton" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="@drawable/registerbutton" 

    android:layout_marginBottom="67dp" 
    android:layout_alignParentBottom="true" 
    android:layout_centerHorizontal="true" /> 

<ImageButton 
    android:id="@+id/loginbutton" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="@drawable/loginbutton" 

    android:layout_above="@+id/regiterbutton" 
    android:layout_alignLeft="@+id/regiterbutton" 
    android:layout_alignStart="@+id/regiterbutton" 
    android:layout_marginBottom="50dp" /> 
</RelativeLayout> 

Mein AndroidManifest.xml ist:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
package="com.example.jawadrauf.ratingapp" > 

<uses-sdk 
    android:minSdkVersion="9" 
    android:targetSdkVersion="16" 
    tools:overrideLibrary="com.facebook" /> 

<application 
    android:allowBackup="true" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 
    <activity 
     android:name=".MainActivity" 
     android:label="@string/app_name" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
</application> 
<!-- Connect to Internet Permissions --> 
<uses-permission android:name="android.permission.INTERNET"/> 
</manifest> 

Mein build.gradle ist:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 17 
    buildToolsVersion '19.1.0' 

defaultConfig { 
    applicationId "com.example.jawadrauf.ratingapp" 
    minSdkVersion 8 
    targetSdkVersion 19 
    versionCode 1 
    versionName "1.0" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt') 
     ,  'proguard-rules.pro' 
     } 
    } 
    } 

repositories { 
// You can also use jcenter if you prefer 
mavenCentral() 
    } 
dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
compile 'com.facebook.android:facebook-android-sdk:4.5.0' 
compile 'com.android.support:appcompat-v7:20.0.0' 

} 
+0

Veröffentlichen Sie Ihre komplette 'activity_main.xml' Datei – Sharj

+0

Danke und fertig –

Antwort

3

AppCompatTextView wurde hinzugefügt in appcompat-v7:22.1.0 und die neueste Version von appcompat-v7 ist 24.0.0. Sie verwenden sehr alte Version 20.0.0 in Ihrer Gradle-Datei.

Sie haben Ihre gradle Datei mit

compile 'com.android.support:appcompat-v7:24.0.0' 

und stellen Sie sicher, in SKD-Manager bearbeiten Sie alle Updates einschließlich der neuesten Version von Support-Bibliotheken installiert haben.

Verwandte Themen