Rendering issue in XML preview : Unable to locate mode 0 [duplicate]

☆樱花仙子☆ 提交于 2019-12-03 22:03:29
Tikhon Osipov

That's problem with RecyclerView in com.android.support:design:25.0.0

Maybe there is some issue in that version. Changed version to 24.1.1 solved my problem.

compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:support-v13:24.1.1'
compile 'com.android.support:design:24.1.1'

in case you not have not removed the default provided gradle imports change this also

androidTestCompile 'com.android.support:support-annotations:24.2.1'

Either downgrade to v24

OR

The following is neither a solution nor a work around.

If you ONLY want to see the PREVIEW, add app:layoutManager="0" for the recyclerView in a layout XML.

Adding this will throw runtime InflateException. So, please remove that property from XML layout file before running the app.

Just change your compileSdkVersion to 24 and downgrade the dependencies:

compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'

That's it.

A Temporary solution is to downgrade your project,

 compile 'com.android.support:appcompat-v7:24.2.1'
 compile 'com.android.support:design:24.2.1'
 compile 'com.android.support:recyclerview-v7:24.2.1'
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!