1

enter image description hereI am trying to open a activity using intent but following error is coming

java.lang.NoClassDefFoundError:

I am using three libraries 1. google play library 2. Sliding menu library 3. Circular Counter library

Logcat

           11-18 13:37:20.781: E/AndroidRuntime(17867): FATAL EXCEPTION: main
           11-18 13:37:20.781: E/AndroidRuntime(17867): Process: com.sayminicabdriver.driverapp, PID: 17867
           11-18 13:37:20.781: E/AndroidRuntime(17867): java.lang.NoClassDefFoundError: com.sayminicabdriver.driverapp.sliding
           11-18 13:37:20.781: E/AndroidRuntime(17867):     at com.sayminicabdriver.driverapp.Login$1.onClick(Login.java:150)
           11-18 13:37:20.781: E/AndroidRuntime(17867):     at android.view.View.performClick(View.java:4438)
           11-18 13:37:20.781: E/AndroidRuntime(17867):     at android.view.View$PerformClick.run(View.java:18422)
           11-18 13:37:20.781: E/AndroidRuntime(17867):     at android.os.Handler.handleCallback(Handler.java:733)
           11-18 13:37:20.781: E/AndroidRuntime(17867):     at android.os.Handler.dispatchMessage(Handler.java:95)
           11-18 13:37:20.781: E/AndroidRuntime(17867):     at android.os.Looper.loop(Looper.java:136)
           11-18 13:37:20.781: E/AndroidRuntime(17867):     at android.app.ActivityThread.main(ActivityThread.java:5001)
           11-18 13:37:20.781: E/AndroidRuntime(17867):     at java.lang.reflect.Method.invokeNative(Native Method)
           11-18 13:37:20.781: E/AndroidRuntime(17867):     at java.lang.reflect.Method.invoke(Method.java:515)
           11-18 13:37:20.781: E/AndroidRuntime(17867):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
           11-18 13:37:20.781: E/AndroidRuntime(17867):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
           11-18 13:37:20.781: E/AndroidRuntime(17867):     at dalvik.system.NativeStart.main(Native Method)

my java code

Login

     @Override
     protected void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.login);
     UserFunctions userFunction = new UserFunctions();
     JSONObject json = userFunction.loginUser(email,
                        password);

     try {
     if (json.getString(KEY_SUCCESS) != null) {

     String res = json.getString(KEY_SUCCESS);
     if (Integer.parseInt(res) == 1) {
     // user successfully logged in
     // Store user details in SQLite Database
     DatabaseHandler db = new DatabaseHandler(
     getApplicationContext());
     JSONObject json_user = json
                                        .getJSONObject("user");
     Intent dashboard = new Intent(Login.this,
                                        sliding.class);
                                // dashboard.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                                startActivity(dashboard);
       catch (JSONException e) {
                        e.printStackTrace();

                    }

Following is my sliding Activity..

sliding Activity

    @Override
    public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
      setBehindContentView(R.layout.content_frame);
     SlidingMenu menu_bus = new SlidingMenu(this);
     SlidingMenu sm = getSlidingMenu();
     sm.setShadowWidthRes(R.dimen.shadow_width);
     sm.setShadowDrawable(R.drawable.shadow);
     sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
     sm.setFadeDegree(0.35f);
     sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);

    //    menu_bus.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
   //firs slide menu, then second
   getSlidingMenu().setMode(SlidingMenu.LEFT_RIGHT);
  getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, new                            MenuFragment()).commit();//mode two menus

        getSlidingMenu().setBehindOffset(50);                  
     //   getSupportActionBar().setDisplayShowCustomEnabled(true);
      //  getSupportActionBar().setDisplayHomeAsUpEnabled(true);        

        getSlidingMenu().setSecondaryMenu(R.layout.right_main);
        getSlidingMenu().setSecondaryShadowDrawable(R.drawable.shadowright);
 //start fragment for second menu
 getSupportFragmentManager()
 .beginTransaction()
 .add(R.id.right_container, new RightFragment(),"test_bus")
 .commit();

 Button csButton=(Button)findViewById(R.id.button1);


   csButton.setOnClickListener(new OnClickListener() {


    @Override
    public void onClick(View arg0) {
        // TODO Auto-generated method stub
        getSlidingMenu().showMenu();

    }//inside csButton1 onclick listener just need to call 

});
   // inside csButton onclick listener just need to call slidingMenu.showSecondaryMenu();
     Button csButton1=(Button)findViewById(R.id.button2);
   csButton1.setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub

        getSlidingMenu().showSecondaryMenu();

    }
}) ;

when my app starts following warnings came and one erroor

Logcat

     11-18 16:19:04.596: W/dalvikvm(8732): Unable to resolve superclass of Landroid/support/v4/app/Watson; (113)
     11-18 16:19:04.596: W/dalvikvm(8732): Link of class 'Landroid/support/v4/app/Watson;' failed
     11-18 16:19:04.596: W/dalvikvm(8732): Unable to resolve superclass of Lcom/actionbarsherlock/app/SherlockFragmentActivity; (121)
     11-18 16:19:04.596: W/dalvikvm(8732): Link of class 'Lcom/actionbarsherlock/app/SherlockFragmentActivity;' failed
      11-18 16:19:04.596: W/dalvikvm(8732): Unable to resolve superclass of Lcom/jeremyfeinstein/slidingmenu/lib/app/SlidingFragmentActivity; (275)
      11-18 16:19:04.596: W/dalvikvm(8732): Link of class 'Lcom/jeremyfeinstein/slidingmenu/lib/app/SlidingFragmentActivity;' failed
      11-18 16:19:04.596: W/dalvikvm(8732): Unable to resolve superclass of Lcom/siliconicpro/sayminicab/sliding; (556)
      11-18 16:19:04.596: W/dalvikvm(8732): Link of class 'Lcom/siliconicpro/sayminicab/sliding;' failed
      11-18 16:19:04.606: E/dalvikvm(8732): Could not find class 'com.siliconicpro.sayminicab.sliding', referenced from method com.siliconicpro.sayminicab.Login$1.onClick
      11-18 16:19:04.606: W/dalvikvm(8732): VFY: unable to resolve const-class 600 (Lcom/siliconicpro/sayminicab/sliding;) in Lcom/siliconicpro/sayminicab/Login$1;

Manifest

    <application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/Widget.Sherlock.ActionBar.Solid" >

    <activity
     android:name="com.siliconicpro.sayminicab.MainActivity"
     android:label="@string/app_name"
      android:windowSoftInputMode="adjustPan"
         >

      <intent-filter>
       <action android:name="android.intent.action.MAIN" />

       <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

        </activity>


       <activity android:name="com.siliconicpro.sayminicab.Register"
        android:windowSoftInputMode="adjustPan"
        android:configChanges="keyboardHidden|orientation|screenSize"/>
        <activity android:name="com.siliconicpro.sayminicab.Login"
        android:windowSoftInputMode="adjustPan"
        android:configChanges="keyboardHidden|orientation|screenSize"/>
        <activity android:name="com.siliconicpro.sayminicab.sliding"
        android:hardwareAccelerated="true"
         android:windowSoftInputMode="adjustPan"
         android:configChanges="keyboardHidden|orientation|screenSize"
          />

I want to clear one thing my app was running successfully during testing i uninstall it from device now this error is coming

I have unchecked private libraries due to following error

         Unable to execute dex: Multiple dex files define              Lcom/jeremyfeinstein/slidingmenu/lib/CanvasTransformerBuilder$1;

Thanks in advance..

1 Answers1

0

First error Android Null point exception probably indicates that you haven't set the classpath option when executing your code. Follow this link to know how to set your classpath. http://en.wikipedia.org/wiki/Classpath_%28Java%29

Now, If you are using an external jar

Copy it to your project's "libs" folder. The Android Tools should do the rest. If the library you want to use is a separate project in your workspace.

In your library project: go into Properties->Android and check the "Is Library" checkbox. In your app project: go into to Properties->Android and add the library project in the same section there (click "Add.."). Don't check "Is Library" here! Some answers to this question say you need to go to Properties->Java Build Path->Projects and add the library project there. For normal Java projects you would do that, but it appears the Android Tools don't need or use that.

Finally, you will probably want to make sure the lib is included in your exported app

Go to Properties->Java Build Path->Order and Export and make sure the library is checked.

Y. Leonce Eyog
  • 883
  • 2
  • 13
  • 29
  • I am not understanding it how to do this –  Nov 18 '14 at 10:02
  • What are your IDE and your OS? – Y. Leonce Eyog Nov 18 '14 at 10:05
  • Eclipse and OS is windows 7 –  Nov 18 '14 at 10:15
  • In eclipse,it is under Window > Preferences > Java > Build Path directory of eclipse that you configure your classpath. I don't really know what you are doing so I'm not sure I can be more precise with the info you gave. – Y. Leonce Eyog Nov 18 '14 at 10:20
  • I have included three libraries and in Build path directory at Libraries tab i have following three option 1. Android 4.2.2 2 Private Libraries 3. Android Dependencies –  Nov 18 '14 at 10:25
  • Now what to do with built path i don't know i have tried every possible solution but fail –  Nov 18 '14 at 10:26
  • When you include libraries you have to add them to the classpath. Click on add jar > location of library. Do that for the 3 libraries. – Y. Leonce Eyog Nov 18 '14 at 10:28
  • Now this error is coming Could not find class 'com.siliconicpro.sayminicab.sliding', referenced from method com.siliconicpro.sayminicab.Login$1.onClick –  Nov 18 '14 at 10:36
  • Good. Then the first Issue was solved. Update your question and give us more information, source code, screen shots. What are those libraries? – Y. Leonce Eyog Nov 18 '14 at 10:43
  • Sorry dear same error is again coming NoClassDefFoundError: –  Nov 18 '14 at 10:46
  • Oh. I misunderstood you but seriously I need more info. – Y. Leonce Eyog Nov 18 '14 at 10:51
  • what info i should provide?? so you can understand it –  Nov 18 '14 at 10:54
  • source code, library names and anything else you might think useful – Y. Leonce Eyog Nov 18 '14 at 10:57
  • While you are at it, restart eclipse and rebuild project. I also need the logcat output when you try to run the app. – Y. Leonce Eyog Nov 18 '14 at 11:00
  • Your manifest file please. I want to see if the classes are correctly defined in the manifest – Y. Leonce Eyog Nov 18 '14 at 11:31
  • See what I said. The first problem was solved. Now you have another. When you update a question, especially when you are not changing the title, you should keep the workflow i.e I have done this then bla bla, next I tried this and this was the output. That's why the others removed their answers. You changed question. – Y. Leonce Eyog Nov 18 '14 at 12:58
  • Problem is still NoClassDeffounder –  Nov 18 '14 at 13:09
  • U asked me to update the java code and manifest so i have done –  Nov 18 '14 at 13:10
  • what is the logcat saying after you added the jars? Is it the same info it's returning?? – Y. Leonce Eyog Nov 18 '14 at 13:23