The hierarchy of the type MainActivity is inconsistent

10,685

Solution 1

Your project should also reference the android-support-v4.jar (which is included in ABS's libs folder.) So, Properties->Java Build Path->Add JARs... and select that jar from ActionBarSherlock->libs

Solution 2

Sometimes, when Eclipse gets retarded, it doesnt add the SDK jar in your project (the Android x.y folder missing in project) so then you need to add it Properties > Android > Project Build Target (usually nothing there is ticked)

Share:
10,685
user2329454
Author by

user2329454

Updated on June 13, 2022

Comments

  • user2329454
    user2329454 about 2 years

    I created a new Android project via eclipse, with a MainActivity. I added ActionBarSherlock to the project (Properties > Android and clicked Add). Then, when I replace "extends Activity" with "extends SherlockFragmentActivity" I get a compile error "The hierarchy of the type MainActivity is inconsistent".

    I also tried to create a project without an Activity, then created a class "MainActivity" that inherits from SherlockFragmentActivity, and there are no compile time errors, but with a run-time error "ClassNotfoundException: com.NadavLitvak.nadavfragmentdemo.MainActivity"