kerabanaga
kerabanaga

Reputation: 53

"android.v4.widget.SlidingPaneLayout class could not be found" exception

I am working on an android application and I want to use SlidingPaneLayout. My activity_main.xml is:

<?xml version="1.0" encoding="utf-8"?>

<android.v4.widget.SlidingPaneLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" tools:context="absolute.beginners.hellouniverse.MainActivity" 
    android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/spLayout" >

    <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content">    
        <TextView android:text="@string/name" />        
    </LinearLayout>

</android.v4.widget.SlidingPaneLayout>

This xml is not giving any error in the xml editor. When I attempt to view the Graphical layout, I keep getting this error:

Exception raised during rendering: com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup
Exception details are logged in Window > Show View > Error Log
The following classes could not be found:
- android.v4.widget.SlidingPaneLayout (Fix Build Path, Edit XML, Create Class)

My uses sdk in the AndroidManifest.xml is:

<uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="19" />

I am using Eclipse IDE Luna Release 2 (4.4.2) on windows 8 machine, and android-sdk and support library is up-to-date to latest version.

I have searched stackoverflow and found a lot of answer about this kind of error. I have tried everything: added android-support-v4.jar file in the libs folder, added that file to "order and export" tab in the build path, restart eclipse, clean project again and again, but I have no solution.

Can anyone help me with this exception?

Update: When I run the app, emulator is opening and my program crashes. Error message is:

03-31 02:13:48.870: E/AndroidRuntime(1129): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class android.v4.widget.SlidingPaneLayout
03-31 02:13:48.870: E/AndroidRuntime(1129):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:707)
03-31 02:13:48.870: E/AndroidRuntime(1129):     at android.view.LayoutInflater.inflate(LayoutInflater.java:469)

Upvotes: 1

Views: 389

Answers (1)

SilentKnight
SilentKnight

Reputation: 14021

Of course you can't. SlidingPaneLayout's full name should be android.support.v4.widget.SlidingPaneLayout but not android.v4.widget.SlidingPaneLayout.

Upvotes: 1

Related Questions