的NoSuchMethodError误差getActionBar()(API-8) [英] NoSuchMethodError error for getActionBar() (API-8)

查看:143
本文介绍了的NoSuchMethodError误差getActionBar()(API-8)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行它安装,但随后崩溃,ecplise心不是讲有什么毛病我code中的应用程序。 我认为它是一个问题,我的清单...

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...

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.secondapp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>                
                <meta-data
                    android:name="android.support.PARENT_ACTIVITY"
                    android:value="com.example.secondapp" />
        </activity>
    </application>

</manifest>

也能跟大家看看什么问题?

do u guys see any problems?

10-19 10:41:25.589: E/AndroidRuntime(10147): FATAL EXCEPTION: main
10-19 10:41:25.589: E/AndroidRuntime(10147): java.lang.NoSuchMethodError: com.example.secondapp.MainActivity.getActionBar
10-19 10:41:25.589: E/AndroidRuntime(10147):    at com.example.secondapp.MainActivity.onCreate(MainActivity.java:15)
10-19 10:41:25.589: E/AndroidRuntime(10147):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-19 10:41:25.589: E/AndroidRuntime(10147):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1722)
10-19 10:41:25.589: E/AndroidRuntime(10147):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1784)
10-19 10:41:25.589: E/AndroidRuntime(10147):    at android.app.ActivityThread.access$1500(ActivityThread.java:123)
10-19 10:41:25.589: E/AndroidRuntime(10147):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:939)
10-19 10:41:25.589: E/AndroidRuntime(10147):    at android.os.Handler.dispatchMessage(Handler.java:99)
10-19 10:41:25.589: E/AndroidRuntime(10147):    at android.os.Looper.loop(Looper.java:130)
10-19 10:41:25.589: E/AndroidRuntime(10147):    at android.app.ActivityThread.main(ActivityThread.java:3835)
10-19 10:41:25.589: E/AndroidRuntime(10147):    at java.lang.reflect.Method.invokeNative(Native Method)
10-19 10:41:25.589: E/AndroidRuntime(10147):    at java.lang.reflect.Method.invoke(Method.java:507)
10-19 10:41:25.589: E/AndroidRuntime(10147):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
10-19 10:41:25.589: E/AndroidRuntime(10147):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
10-19 10:41:25.589: E/AndroidRuntime(10147):    at dalvik.system.NativeStart.main(Native Method)

这是logcat的,不知道这是否会帮助

this is the logcat, not sure if this will help

推荐答案

使用 getSupportActionBar 可与支持库V7所描述的<一个href="http://android-developers.blogspot.co.il/2013/08/actionbarcompat-and-io-2013-app-source.html">here在 6。检索操作栏部分。

Use getSupportActionBar available with support library v7 as described here on the 6. Retrieve the Action Bar section

<一个href="https://developer.android.com/reference/android/support/v7/app/ActionBarActivity.html#getSupportActionBar%28%29">getSupportActionBar文档

这篇关于的NoSuchMethodError误差getActionBar()(API-8)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆