6

I update Android Studio to version 2.2.2 and after that I changed compileSdkVersion and buildToolVersion to 25.0.0 and appcompat-V7:25.0.0, Now I can't build project and run project perfectly but I have an error on during rendering activities that contain RecyclerView. here is error detail:

java.lang.IllegalStateException: Unable to locate mode 0 at android.view.DisplayInfo.findMode(DisplayInfo.java:458) at android.view.DisplayInfo.getMode(DisplayInfo.java:445) at android.view.Display.getRefreshRate(Display.java:648) at android.support.v7.widget.RecyclerView.onAttachedToWindow(RecyclerView.java:2392) 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.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$53(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)

Does anyone run into the same problem? any solution!?

3
  • I got the same problem, but I am not using a RecyclerView :|
    – Michael
    Oct 21, 2016 at 13:18
  • You can check the issue in the Google Tracker: code.google.com/p/android/issues/detail?id=225753 The error is only related to the IDE Oct 21, 2016 at 19:44
  • as @GabrieleMariotti mentioned, it is on going issue and no temporary fix has been released yet. For me I simply comment out RecyclerView temporarily and then i am able to see preview. Once u finished, just uncomment it back. ;-)
    – Tixeon
    Nov 9, 2016 at 5:43

3 Answers 3

15

It's a bug of Android Support Library version 25.0.0, and have fixed in new 25.0.1!

compile 'com.android.support:recyclerview-v7:25.0.1'
1
  • It's not the first time Google has this huge issues with the libraries. Thanks! Dec 27, 2016 at 1:18
-2

In build.gradle(Module:App) change the version of RecyclerView from 25 to 24.

compile 'com.android.support:recyclerview-v7:24.0.0'
1
  • I'm using last version and I want answer for last version, I know how to I can use previous version
    – Mehdi
    Oct 26, 2016 at 10:21
-3

same Problem here. Temporarily fixed it by setting my build.gradle to compile appcompat-v7:24.0.3 instead of the 25.0.0. Hopes this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.