Rendering issues: Failed to instantiate class: - android.support.v4.widget.DrawerLayout
I am a beginner and am trying to develop an android app. I used the following tutorial and everything is fine (i.e. error / red icon). http://developer.android.com/training/implementing-navigation/nav-drawer.html
However, the following error occurs in the activity xml file: The following classes could not be generated: - android.support.v4.widget.DrawerLayout (Open Class, Show Exception)
I have searched google and Stack Overflow. Found a similar question, however no one answered for them. Assuming someone else ran into the same problem and was able to solve it.
Note. I am using Android-Studio.
Activty.xml have the following flow:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout" ...........
tools:context=".MyActivity">
<FrameLayout
android:id="@+id/content_frame"........
android:layout_alignParentEnd="true">
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
<ListView android:id="@+id/left_drawer"
android:layout_width="240dp"........
android:background="#111"/>
</android.support.v4.widget.DrawerLayout>
source to share
From http://developer.android.com/training/implementing-navigation/nav-drawer.html :
This tutorial describes how to implement a navigation drawer using the DrawerLayout APIs available in the support library.
Are you sure you linked the Support Library correctly ?
source to share
I solved this issue when installing additional platform components by following these steps:
Click on the menu "Tools → Android → SDK Manager".
Then click on Appearance and Behavior → System Settings → Android SDK.
On the SDK Platforms tab, check all of the options above (including) "Android 4.0.3 (IceCreamSandwich)".
Click "Apply", wait until finished and ready!
Hope it helps.
source to share