NoSuchMethodError error for getActionBar() (API-8)

后端 未结 6 1967
醉酒成梦
醉酒成梦 2020-12-17 09:59

when i run the app it installs but then crashes, ecplise isnt telling there is anything wrong with my code. i think its a problem with my manifest...



        
6条回答
  •  孤城傲影
    2020-12-17 11:01

    For api < 11 you have to use:

    getSupportActionBar();
    

    Algo make sure you are using appcompat, add this on build.gradle, the 19.+ should be your project target version.

    compile 'com.android.support:appcompat-v7:19.+'
    

    Also if you are using invalidateOptionsMenu() for navigation drawer use this instead:

    supportInvalidateOptionsMenu();
    

提交回复
热议问题