0

I have an app where there is a sliding menu. I have implemented it using the jfeinstein's library. It was working perfectly fine till yesterday but it has stopped working now. I haven't even made any changes to the code. Here is the error report:

08-20 15:02:52.060: E/AndroidRuntime(32366): FATAL EXCEPTION: main
08-20 15:02:52.060: E/AndroidRuntime(32366): java.lang.RuntimeException: Unable to start     activity ComponentInfo{com.cvapp/com.cvapp.SecondActivity}: android.view.InflateException:  Binary XML file line #2: Error inflating class  com.jeremyfeinstein.slidingmenu.lib.SlidingMenu
08-20 15:02:52.060: E/AndroidRuntime(32366):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at android.app.ActivityThread.access$600(ActivityThread.java:140)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at android.os.Handler.dispatchMessage(Handler.java:99)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at android.os.Looper.loop(Looper.java:137)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at android.app.ActivityThread.main(ActivityThread.java:4898)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at java.lang.reflect.Method.invokeNative(Native Method)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at java.lang.reflect.Method.invoke(Method.java:511)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at dalvik.system.NativeStart.main(Native Method)
08-20 15:02:52.060: E/AndroidRuntime(32366): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class com.jeremyfeinstein.slidingmenu.lib.SlidingMenu
08-20 15:02:52.060: E/AndroidRuntime(32366):    at android.view.LayoutInflater.createView(LayoutInflater.java:613)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityHelper.onCreate(SlidingActivityHelper.java:45)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivity.onCreate(SlidingActivity.java:22)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at com.cvapp.SecondActivity.onCreate(SecondActivity.java:19)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at android.app.Activity.performCreate(Activity.java:5206)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
08-20 15:02:52.060: E/AndroidRuntime(32366):    ... 11 more
08-20 15:02:52.060: E/AndroidRuntime(32366): Caused by: java.lang.reflect.InvocationTargetException
08-20 15:02:52.060: E/AndroidRuntime(32366):    at java.lang.reflect.Constructor.constructNative(Native Method)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at android.view.LayoutInflater.createView(LayoutInflater.java:587)
08-20 15:02:52.060: E/AndroidRuntime(32366):    ... 21 more
08-20 15:02:52.060: E/AndroidRuntime(32366): Caused by: java.lang.NoClassDefFoundError: android.support.v4.view.ViewConfigurationCompat
08-20 15:02:52.060: E/AndroidRuntime(32366):    at com.jeremyfeinstein.slidingmenu.lib.CustomViewAbove.initCustomViewAbove(CustomViewAbove.java:167)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at com.jeremyfeinstein.slidingmenu.lib.CustomViewAbove.<init>(CustomViewAbove.java:157)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at com.jeremyfeinstein.slidingmenu.lib.CustomViewAbove.<init>(CustomViewAbove.java:152)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at com.jeremyfeinstein.slidingmenu.lib.SlidingMenu.<init>(SlidingMenu.java:209)
08-20 15:02:52.060: E/AndroidRuntime(32366):    at com.jeremyfeinstein.slidingmenu.lib.SlidingMenu.<init>(SlidingMenu.java:192)
08-20 15:02:52.060: E/AndroidRuntime(32366):    ... 24 more

Here is my code:

main:

package com.cvapp;

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivity;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;


public class SecondActivity extends SlidingActivity {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_second);
    setBehindContentView(R.layout.activity_menu1);
    getSlidingMenu().setBehindOffset(100);

    SlidingMenu menu = getSlidingMenu();
    menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);

    setOnClickListener();
}
   @Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.second, menu);
    return true;
}

}

xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:background="@drawable/pic9"
        android:clickable="true"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context=".SecondActivity" >

     <TextView
         android:id="@+id/textView2"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_alignParentTop="true"
         android:layout_marginLeft="16dp"
         android:layout_marginTop="27dp"
         android:text="Hello"
         android:textColor="#000000"
         android:textSize="16sp"
         android:textStyle="bold" />

</RelativeLayout>

And, if it helps, I have followed this tutorial to set up the Sliding Menu.

Anish
  • 740
  • 4
  • 11
  • 27
  • 2
    probably this is the culprit. Caused by: java.lang.NoClassDefFoundError: android.support.v4.view.ViewConfigurationCompat See if the support package v4 is added to your project already. if not, add it to your project and it should resolve it. – Andro Selva Aug 20 '13 at 09:54
  • 1
    @AndroSelva Hey man, can you send me a picture of yours so that I can worship it daily because THAT HAS JUST WORKED FOR ME!!! It was indeed the missing support package v4.. No idea how it suddenly went missing.. Thanks a lot!! – Anish Aug 20 '13 at 10:11
  • No worries my friend.. Am happy it solved your issue.. BTW you don't have to worship me. :P – Andro Selva Aug 20 '13 at 10:17

3 Answers3

0

FYI, you'd better add support package v4 from library project, instead of copy it to local libs. And remember to add library to your sliding menu application.

Bin
  • 222
  • 2
  • 15
0

Finally I got it.. u just have to right click on your project > Android Tools > Add Support Library, so the prblem was the missing support package v4..

0

I have got the same issue and I have resolved finally Opening the gradle.properties and added following: android.enableAapt2=false

Shahid Aslam
  • 2,585
  • 3
  • 24
  • 31