NoSuchMethodError error for getActionBar() (API-8)

后端 未结 6 1973
醉酒成梦
醉酒成梦 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 10:55

    You are probably running on a phone that is lower than API 11, which is when the method getActionBar was introduced. If you need to run on devices lower than API level 11, then you will need to guard against executing those calls that only exist on newer API levels, or else use a compatibility library such as ActionBarSherlock or Action Bar Compatiblity. (See this thread for a discussion of the differences between these two.)

    Change the android:minSdkVersion="8" to android:minSdkVersion="11" and all the newer API calls that you are making will light up as errors. This will make it easier to locate those parts of your code that need attention.

提交回复
热议问题