2016-05-12 3 views
0

Wenn ich RecyclerView in meinem XML verwenden, habe ich einen "Parsing-Fehler" in dem Entwicklungsbereich des XML:RecyclerView mit der beschrifteten Seite von xml

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="horizontal" android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:text="@string/app_name"/> 

    <android.support.v7.widget.RecyclerView 
     android:id="@+id/recycler_view" 
     android:scrollbars="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"/> 

</LinearLayout> 
: graphical editor

Das ist meine XML

im Gradle kompilieren ich diese libs:

compile 'com.android.support:recyclerview-v7:23.3.0' 
compile 'com.android.support:appcompat-v7:23.3.0' 

und das ist das SDK ich benutze:

minSdkVersion 16 
targetSdkVersion 23 

Dies ist, was ich in meinem "Parsing-Fehler" haben:

Parsing error 
ActiveTool: [email protected] 
SDK: Android API 23 - API 23 
java.lang.RuntimeException: java.lang.ClassNotFoundException: android.support.v7.widget.RecyclerView 
    at com.intellij.android.designer.model.RadModelBuilder.updateHierarchy(RadModelBuilder.java:329) 
    at com.intellij.android.designer.model.RadModelBuilder.updateHierarchy(RadModelBuilder.java:346) 
    at com.intellij.android.designer.model.RadModelBuilder.updateHierarchy(RadModelBuilder.java:203) 
    at com.intellij.android.designer.model.RadModelBuilder.build(RadModelBuilder.java:169) 
    at com.intellij.android.designer.model.RadModelBuilder.update(RadModelBuilder.java:85) 
    at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$4.consume(AndroidDesignerEditorPanel.java:327) 
    at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$4.consume(AndroidDesignerEditorPanel.java:287) 
    at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$7$2.run(AndroidDesignerEditorPanel.java:553) 
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:337) 
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:321) 
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) 
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:715) 
    at java.awt.EventQueue.access$400(EventQueue.java:82) 
    at java.awt.EventQueue$2.run(EventQueue.java:676) 
    at java.awt.EventQueue$2.run(EventQueue.java:674) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86) 
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:685) 
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:866) 
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:654) 
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:381) 
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296) 
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211) 
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201) 
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196) 
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188) 
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) 
Caused by: java.lang.ClassNotFoundException: android.support.v7.widget.RecyclerView 
    at org.jetbrains.android.uipreview.ModuleClassLoader.load(ModuleClassLoader.java:154) 
    at com.android.tools.idea.rendering.RenderClassLoader.findClass(RenderClassLoader.java:52) 
    at org.jetbrains.android.uipreview.ModuleClassLoader.findClass(ModuleClassLoader.java:92) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247) 
    at com.intellij.android.designer.model.PropertyParser.load(PropertyParser.java:93) 
    at com.intellij.android.designer.model.RadModelBuilder.updateHierarchy(RadModelBuilder.java:326) 
    ... 26 more 
+0

Ich denke, Sie sollten Unterstützung lib in build.gradle –

+0

ich hinzufügen, dass lib: kompilieren 'com.android.support:recyclerview-v7:23.3.0' –

+0

Add Kompilierung ‚com.android.support:appcompat-v7 : 23.2.0 'und dann versuchen, das Projekt zu säubern und zu bauen. –

Antwort

0

versuchen, diese Zeilen hinzuzufügen.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:tools="http://schemas.android.com/tools" 
     xmlns:app="http://schemas.android.com/apk/res-auto"  
     android:orientation="horizontal" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" > 

Oder

versuchen das Studio neu zu starten .. manchmal Studio Problem schafft.

+0

Danke, aber diese Änderung nichts ... –

+1

können Sie versuchen, das Studio neu zu starten? –

+0

Ja, es funktioniert jetzt! Danke :) –

Verwandte Themen