android编程stop,请问,Android studio程序不报错,但是一运行就stop是什原因

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

02/07 08:59:56: Launching app

$ adb shell am start -n "com.dong.dongweather/com.dong.dongweather.LoginActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER

Client not ready yet..Waiting for process to come online

Connected to process 16018 on device emulator-5554

Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.

I/InstantRun: starting instant run server: is main process

D/AndroidRuntime: Shutting down VM

E/AndroidRuntime: FATAL EXCEPTION: main

Process: com.dong.dongweather, PID: 16018

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dong.dongweather/com.dong.dongweather.LoginActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference

at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)

at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)

at android.app.ActivityThread.-wrap11(Unknown Source:0)

at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)

at android.os.Handler.dispatchMessage(Handler.java:106)

at android.os.Looper.loop(Looper.java:164)

at android.app.ActivityThread.main(ActivityThread.java:6494)

at java.lang.reflect.Method.invoke(Native Method)

at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference

at com.dong.dongweather.LoginActivity.onCreate(LoginActivity.java:40)

at android.app.Activity.performCreate(Activity.java:6999)

at android.app.Activity.performCreate(Activity.java:6990)

at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)

at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)

at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)

at android.app.ActivityThread.-wrap11(Unknown Source:0)

at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)

at android.os.Handler.dispatchMessage(Handler.java:106)

at android.os.Looper.loop(Looper.java:164)

at android.app.ActivityThread.main(ActivityThread.java:6494)

at java.lang.reflect.Method.invoke(Native Method)

at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Application terminated.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值