Already seen: NoClassDefFoundError Android with ActionBarActivity and ActionBarActivity catch an error on Phone
I am trying to use ActionBarCompact in my project. I have linked android-support-v7 project as well as its jar in my project following and checking the steps from lots of sources, but still I am unable to deal with the problem.
When I built my project, there is no error, but there is exception at runtime. Don't know why class is not detected. Please tell me what is wrong. Thanks.
Code:
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.widget.ArrayAdapter;
public class mainMenu extends ActionBarActivity implements ActionBar.OnNavigationListener {
ActionBar actionbar;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menutab);
actionbar = getSupportActionBar();
actionbar.setTitle("Menu");
actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
ArrayAdapter<CharSequence> mSpinnerAdapter = ArrayAdapter.createFromResource(this,R.array.menu_items, R.id.simpleText);
actionbar.setListNavigationCallbacks(mSpinnerAdapter, this);
}
@Override
public boolean onNavigationItemSelected(int arg0, long arg1)//item pos, itemid
{
switch (arg0) {
case 0:
System.out.println("selected: " + arg0);
break;
case 1:
System.out.println("selected: " + arg0);
break;
case 2:
System.out.println("selected: " + arg0);
break;
case 3:
System.out.println("selected: " + arg0);
break;
default:
break;
}
return true;
}
}
------------Project Structure and Build Path-----------------
Logcat
[2013-09-17 16:59:57 - android-support-v7-appcompat] Could not find android-support-v7-appcompat.apk!
in console when I run app. – Lorusso