1

enter image description hereIn the code below, I tried to check root access using roottools. There aren't any syntax errors but whenever I click the "Check Root Access" button, I get an "application has stopped unexpectedly" message. Please help.

package com.maverick.checkforroot;

import com.stericson.RootTools.RootTools;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    TextView Manufacturer = (TextView) findViewById(R.id.Manufacturer);
    String Manu = android.os.Build.MANUFACTURER;;
    Manufacturer.setText(Manu);

    TextView tv1 = (TextView) findViewById(R.id.tv1);
    String Model = android.os.Build.MODEL;
    tv1.setText(Model);

    TextView Product = (TextView) findViewById(R.id.Product);
    String Pro = android.os.Build.PRODUCT;;
    Product.setText(Pro);

    Button Root = (Button) findViewById(R.id.Root);
    Root.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            if (RootTools.isAccessGiven()) {
                Toast.makeText(MainActivity.this,"Root Access!", Toast.LENGTH_LONG).show();
            }
            else  {
                Toast.makeText(MainActivity.this,"No Root Access!", Toast.LENGTH_LONG).show();
            }
        }
    });
}}

1 Answers1

3

Try this:

Go to Project/Properties/Java Build Path/Order and Export tab -- Make sure there's a check in front of Android Dependencies and the support library, if you use it.Mark all checkboxes and Click on Apply and clean the project.

Raghunandan
  • 132,755
  • 26
  • 225
  • 256
Siddharth_Vyas
  • 9,972
  • 10
  • 39
  • 69
  • 2
    exact duplicate of this http://stackoverflow.com/questions/22214603/android-java-lang-noclassdeferror-when-using-external-jar. post links instead of duplicating – Raghunandan Mar 06 '14 at 04:22
  • Working! I had to work around with the Java Build Path. Thank you so much! –  Mar 06 '14 at 04:30
  • @The Maverick : Please accept the answer if above solution worked for you. – Siddharth_Vyas Mar 06 '14 at 04:32
  • @SiddharthVyas http://meta.stackexchange.com/questions/180207/how-to-flag-duplicate-answers. You should not duplicate your answers. Delete the other one as this is accepted – Raghunandan Mar 06 '14 at 04:35
  • @Raghunandan : I am extremely sorry for this..From now onwards, I will take care of this..Thanks for updating this.. – Siddharth_Vyas Mar 06 '14 at 04:36
  • @SiddharthVyas still you should delete the other duplicate. You can keep this as this is accepted and that is not – Raghunandan Mar 06 '14 at 04:37
  • @Raghunandan I have deleted the previous answers post.Thanks for guiding me. – Siddharth_Vyas Mar 06 '14 at 04:39