java.lang.RuntimeException: Unable to start activity ComponentInfo

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/qq_43274298/article/details/102708139

android activity打不开,具体错误如下:

10-23 10:00:05.739 9655-9655/com.example.fragmentbestpractice E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.fragmentbestpractice, PID: 9655
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.fragmentbestpractice/com.example.fragmentbestpractice.NewsContentActivity}: java.lang.NullPointerException: Attempt to invoke virtual method ‘void android.view.View.setVisibility(int)’ on a null object reference

定位acitivity

setContentView(R.layout.activity_main);

定位activity_main.xml

<view
        android:layout_width="1dp"
        android:layout_height="match_parent"
        android:layout_alignParentLeft="true"
        android:background="#000" />

这里的“view”的“v”应该大写“V”,才是Android库中的View。

猜你喜欢

转载自blog.csdn.net/qq_43274298/article/details/102708139
今日推荐