Android Studio Rendering Problems After Studio Update
This article covers several fixes that have solved the Android Studio rendering problems error message that occassionally occurs. Android Studio is Google's development IDE for Android Apps. Studio is in constant development and as an Android developer you will get used to updating Studio often. Unfortunately the updates will sometimes break existing projects. One of the common errors after an update is an App's screen failing to display when the layout file is opened in the editor's Design tab. Instead of the correct screen being shown it is greyed out and overlaid with a Rendering Problems message. Even though the screen displayed correctly before the Studio update. For example the following rendering problems message is saying that there are Missing styles:
Other rendering problem bugs can appear, e.g. Rendering failed with a known bug or The following classes could not be instantiated. Changes in the Android Software Development Kit (SDK) can sometimes affect previously working projects. The project files may need some minor changes to update them to the new SDK.
The Rendering Problems Quick Fix
Sometimes just changing the rendering version (above the Design window) will fix the Rendering Problems error (see the item in the list of fixes). Also opening the the AppTheme dialog, using the AppTheme button (again at the top of the Design window), and clicking OK will fix the rendering problem. If that does not work try reselecting All then AppTheme in the Select Theme dialog. Another quick fix to try is to compile against a previous Android library version. Nearly every SDK update changes the Android libraries and can add beta versions of forthcoming Android releases. Reverting a probject from a beta library to a previous release can sometimes solve a rendering problem, as described in the Different Libraries solution in the following fixes. If these two fixes don't work try the other fixes below as a solution to any rendering problems message.
List of Possible Fixes for Android Studio Rendering Problems
Here are some solutions to rendering problems in Android Studio. They may not solve you particular issue but have worked in the past, depending upon what has been updated in Studio. These fixes are for when a project was previously compiling and displaying OK in Studio, but after an update the App screens no longer display correctly. These fixes are not guaranteed to work, especially if the code was NOT previously compiling. For previously working code these fixes, or a combination of these solutions, have solved past rendering problems issues.
Change Android Version for Rendering Layouts
Changing the version of Android for rendering layouts can resolve the rendering problems error, especially is beta versions of new Android releases are installed. Use the dropdown above the design area for the opened layout to change the Android version for rendering:
Clean the Project to Fix Rendering Problems
Use the Clean Project menu option under the Build menu in Studio. This occasionally fixes rendering problems.
Update the Studio Cache to Fix Rendering Problems
Rebuilding Studio's cache can sometimes fix the rendering problems. Close all but one Android project. Use the File menu to select Invalidate Caches/Restart. Confirm the action when the Invalidate Caches message box appears by clicking the Invalidate and Restart button.
Sync Gradle to Fix Rendering Problems
Try resyncing Gradle with the Android project. Use the Sync Project with Gradle Files button on the toolbar. Alternative use the Tools then Android menu option and select Sync Project with Gradle Files.
Update the Project Files to Use Different Library Versions
Check to see if the correct libraries for the project are still installed. For example the v7 appcompat library and associated v4 Support library. First check the SDK directory to see the versions of the libraries available:
Then check the version in the App's Gradle file (the build.gradle file in the app directory):
Change the version if required, you may be prompted to synch Gradle.
Change an Apps Theme to Fix Rendering Problems
All of the above solutions to layout rendering problems do not change any of the code files for an App. If all the above has been tried and the problems persist further investigation of the error may be needed. Ultimately this could include recreating the App in a new project (copying all the code over) and comparing the new project with the old to determine the issue. (For large projects that may not be a trivial task). Alternatively changing the Apps theme has fixed rendering problems. Use the AppTheme button when viewing a screen in the Design tab to access the available theme definitions. Choose a new theme for an App, e.g. Holo.
- Rendering Problems with WindowDecorActionBar
- Overview of the Android Support Library
- Styles and Themes on Android Developer
Author:Daniel S. Fowler Published: Updated: