Android Studio Activity Intent 闪退崩溃 Toolbar_移动开发_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > 移动开发 > Android Studio Activity Intent 闪退崩溃 Toolbar

Android Studio Activity Intent 闪退崩溃 Toolbar

 2017/11/17 23:18:17  牧心星语  程序员俱乐部  我要评论(0)
  • 摘要:今天写登录注册页面,点击登录页面的“注册”按钮后软件突然崩溃,直接闪退,因为是新手,只能去网上搜。虽然网上解决方法众多,但也没找到可行的。想起来可以看Logcat,马上重新运行应用,查看崩溃时的日志,发现日志比较多,还都不认识,只好又复制日志上网搜索,无果。突发奇想,把注册页面有关Toolbar的内容删掉,重新运行应用,竟然成功从登录页面切换到注册页面。可能是注册页面的Toolbar和登录页面冲突了,具体原因未明,只能先不用这个Toolbar了。Logcat11-1708:36:20
  • 标签:android Studio Intent Ten Activity

今天写登录注册页面,点击登录页面的“注册”按钮后软件突然崩溃,直接闪退,因为是新手,只能去网上搜。虽然网上解决方法众多,但也没找到可行的。想起来可以看Logcat,马上重新运行应用,查看崩溃时的日志,发现日志比较多,还都不认识,只好又复制日志上网搜索,无果。突发奇想,把注册页面有关Toolbar的内容删掉,重新运行应用,竟然成功从登录页面切换到注册页面。可能是注册页面的Toolbar和登录页面冲突了,具体原因未明,只能先不用这个Toolbar了。

Logcat

11-17 08:36:20.241 2389-2389/? E/libprocessgroup: failed to make and chown /acct/uid_10066: Read-only file system
11-17 08:36:20.241 2389-2389/? W/Zygote: createProcessGroup failed, kernel missing CONFIG_CGROUP_CPUACCT?
11-17 08:36:20.241 2389-2389/? I/art: Late-enabling -Xcheck:jni
11-17 08:36:20.346 2389-2389/com.example.zz.ebuy W/System: ClassLoader referenced unknown path: /data/app/com.example.zz.ebuy-1/lib/x86
11-17 08:36:20.375 2389-2389/com.example.zz.ebuy W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
11-17 08:36:20.454 2389-2402/com.example.zz.ebuy D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true

[ 11-17 08:36:20.494 2389: 2389 D/ ]
HostConnection::get() New Host Connection established 0xed656860, tid 2389
11-17 08:36:21.046 2389-2402/com.example.zz.ebuy D/libEGL: loaded /system/lib/egl/libEGL_emulation.so
11-17 08:36:21.047 2389-2402/com.example.zz.ebuy D/libEGL: loaded /system/lib/egl/libGLESv1_CM_emulation.so
11-17 08:36:21.066 2389-2402/com.example.zz.ebuy D/libEGL: loaded /system/lib/egl/libGLESv2_emulation.so

[ 11-17 08:36:21.089 2389: 2402 D/ ]
HostConnection::get() New Host Connection established 0xeea12890, tid 2402
11-17 08:36:21.142 2389-2402/com.example.zz.ebuy I/OpenGLRenderer: Initialized EGL, version 1.4
11-17 08:36:21.384 2389-2402/com.example.zz.ebuy W/EGL_emulation: eglSurfaceAttrib not implemented
11-17 08:36:21.384 2389-2402/com.example.zz.ebuy W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xeea13560, error=EGL_SUCCESS
11-17 08:36:24.441 2389-2389/com.example.zz.ebuy D/AndroidRuntime: Shutting down VM
11-17 08:36:24.442 2389-2389/com.example.zz.ebuy E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.zz.ebuy, PID: 2389
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.zz.ebuy/com.example.zz.ebuy.SignUp}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.Toolbar.setLogo(int)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.Toolbar.setLogo(int)' on a null object reference
at com.example.zz.ebuy.SignUp.onCreate(SignUp.java:33)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
at android.app.ActivityThread.-wrap11(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5417) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
11-17 08:36:28.615 2389-2389/com.example.zz.ebuy I/Process: Sending signal. PID: 2389 SIG: 9

Toolbar代码

1         Toolbar toolbar = findViewById(R.id.toolbar);
2         setSupportActionBar(toolbar);
3         toolbar.setLogo(R.drawable.ebuy);
4         toolbar.setTitle("eBuy");

 

发表评论
用户名: 匿名