应用程序在启动时停止

时间:2014-12-31 19:44:11

标签: java android

我试图启动我的APP并且它永远不会显示,唯一的错误显示是:

        DEVICE SHELL COMMAND: am start -D -n "navigationdrawer.tutecentral.com.jddsoft_app/navigationdrawer.tutecentral.com.jddsoft_app.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
    WARNING: linker: app_process has text relocations. This is wasting memory and is a security risk. Please fix.
    WARNING: linker: app_process has text relocations. This is wasting memory and is a security risk. Please fix.
    Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=navigationdrawer.tutecentral.com.jddsoft_app/.MainActivity }
Warning: debug info can be unavailable. Please close other application using ADB: Monitor, DDMS, Eclipse

我没有更多的应用程序正在运行,我已关闭Android Studio并且我已经再次打开并且仍然没有工作。

EDITED *

 12-31 20:58:21.919  25772-25772/navigationdrawer.tutecentral.com.jddsoft_app E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: navigationdrawer.tutecentral.com.jddsoft_app, PID: 25772
    java.lang.RuntimeException: Unable to start activity ComponentInfo{navigationdrawer.tutecentral.com.jddsoft_app/navigationdrawer.tutecentral.com.jddsoft_app.MainActivity}: java.lang.NullPointerException
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
            at android.app.ActivityThread.access$800(ActivityThread.java:139)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5102)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.NullPointerException
            at navigationdrawer.tutecentral.com.jddsoft_app.MainActivity.onCreate(MainActivity.java:76)
            at android.app.Activity.performCreate(Activity.java:5248)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2173)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
            at android.app.ActivityThread.access$800(ActivityThread.java:139)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5102)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)

点击(MainActivity.java:76)

 getActionBar().setDisplayHomeAsUpEnabled(true);

这是问题吗,返回nullPointerException?

2 个答案:

答案 0 :(得分:2)

您的操作栏返回null。检查你是否有一个主题,你有actionBar,并且它有一个标题。

但是如果你使用的是min SDK< 11然后你必须使用appcompat库并使用你可以使用getSupportActionBar()获得的supportActionBar,你的活动必须扩展ActionBarActivity。

答案 1 :(得分:0)

试试这个,打开cmd 型

adb kill-server

然后

adb start-server

然后关闭eclipse和任何其他IDE,然后尝试运行应用程序