Android Studio rendering problems

2019-01-01 00:06发布

I'm using Android Studio 0.2.3 and when opened an activity layout normally, the preview should appear on the right side, so that I can switch between Text and Design mode, which should again show the preview of the layout.

But no preview is shown not on the right side neither when I'm in text mode nor in the design mode. I just get the error rendering problems...

When I compile everything and install the app on my device, it works without any errors. For developing and experimenting with the layout, it would still be nice if I could get the preview to work.

I have also tried to switch between different devices in the studio, but no success.

Does anyone know how solve this?

13条回答
梦寄多情
2楼-- · 2019-01-01 00:46

Make sure your designer version and targetSdkVersion both is same. Example : If your targetSdkVersion is 22 then change your designer version also 22, so this problem do not occur.

查看更多
浮光初槿花落
3楼-- · 2019-01-01 00:47
  1. Open AndroidManifest.xml
  2. Change:

    android:theme="@style/AppTheme"

    to something like:

    android:theme="@style/Theme.AppCompat.Light"
  3. Hit "refresh" button in the "Previev" tab.
查看更多
倾城一夜雪
4楼-- · 2019-01-01 00:49

Best Solution is go to File -> Sync Project With Gradle Files

I hope this helped

查看更多
泪湿衣
5楼-- · 2019-01-01 01:00

I have solved the Problem by changing style.xml

<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
     <!-- Customize your theme here. -->
</style>

this was an awesom solution.

查看更多
梦该遗忘
6楼-- · 2019-01-01 01:02

Rendering didn't work for me too. I had <null> value on the right side of the android icon. I ran

sudo apt-get install gradle

I restarted Android studio then and <null> value changed to 23.

Voila, it renders now! :)

enter image description here

查看更多
千与千寻千般痛.
7楼-- · 2019-01-01 01:03

I was able to fix this in Android Studio 0.2.0 by changing API from API 18: Android 4.3 to API 17: Android 4.2.2

This is under the Android icon menu in the top right of the design window.

This was a solution from http://www.hankcs.com/program/mobiledev/idea-this-version-of-the-rendering-library-is-more-recent-than-your-version-of-intellij-idea-please-update-intellij-idea.html.This required a Google translation into English since it was in another language.

Hope it helps.

查看更多
登录 后发表回答