2016-12-19 7 views
0

私のアプリケーションでRecyclerViewを使用しようとしています。コード:レンダリング中に、RecyvlerViewを使用して例外が発生しました

活動:

public class TecnicoActivity extends Activity { 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.tecnicolayout); 
} 
} 

レイアウト:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" android:layout_height="match_parent"> 

<android.support.v7.widget.RecyclerView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentStart="true" /> 
</RelativeLayout> 

この方法で、私はレイアウトウィンドウにエラーメッセージを受信して​​います:

詳細ショーでクリック
Exception raised during rendering: 
android.support.v4.view.ViewCompat.getDisplay(Landroid/view/View;)Landroid/view/Display;(Details) 

をこの例外:

java.lang.NoSuchMethodError: android.support.v4.view.ViewCompat.getDisplay(Landroid/view/View;)Landroid/view/Display; 
at android.support.v7.widget.RecyclerView.onAttachedToWindow(RecyclerView.java:2447) 
at android.view.View.dispatchAttachedToWindow(View.java:15392) 
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2953) 
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960) 
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960) 
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960) 
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960) 
at android.view.AttachInfo_Accessor.setAttachInfo(AttachInfo_Accessor.java:42) 
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:333) 
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429) 
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:389) 
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:548) 
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:533) 
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:966) 
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:533) 
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$70(RenderTask.java:659) 
at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
at java.lang.Thread.run(Thread.java:745) 

私のGradleファイル:私はこのエラーを取り除くことができますどのように

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
    exclude group: 'com.android.support', module: 'support-annotations' 
}) 
compile 'com.android.support:appcompat-v7:22.2.1' 
testCompile 'junit:junit:4.12' 
compile 'com.android.support:design:22.2.0' 
compile 'com.android.support:recyclerview-v7:+' 
} 

+0

です.com/questions/40161934/exception-raised-during-rendering-unable-to-locate-mode-0) – Soren

答えて

1

繰り返し質問 [レンダリング中に発生した例外:モード0

Exception raised during rendering: Unable to locate mode 0

アプリレベルのGradle最新のGoogleのライブラリを使用してコンパイル

この

compile 'com.android.support:recyclerview-v7:2x.x.x' compile 'com.android.support:appcompat-v7:2x.x.x' compile 'com.android.support:design:2x.x.x'

を行い見つけることができません2x.xxは最新のgの最新バージョンです(のhttp:// stackoverflowの:ライブラリ

APK oogleこの記事の時点でそれは[モード0を見つけることができませんレンダリング中に発生した例外]の可能性のある重複

25.3.1

関連する問題