记录错误:java.lang.RuntimeException: Unable to start activity ComponentInfo

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

01-02 00:02:25.495 E/AndroidRuntime(  984): FATAL EXCEPTION: main
01-02 00:02:25.495 E/AndroidRuntime(  984): Process: com.skypine.widescreen.tuner, PID: 984
01-02 00:02:25.495 E/AndroidRuntime(  984): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.skypine.widescreen.tuner/com.skypine.widescreen.tuner.ui.TunerActivity}: android.view.InflateException: Binary XML file line #9: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
01-02 00:02:25.495 E/AndroidRuntime(  984): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
01-02 00:02:25.495 E/AndroidRuntime(  984): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2477)
01-02 00:02:25.495 E/AndroidRuntime(  984): at android.app.ActivityThread.-wrap11(ActivityThread.java)
01-02 00:02:25.495 E/AndroidRuntime(  984): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
01-02 00:02:25.495 E/AndroidRuntime(  984): at android.os.Handler.dispatchMessage(Handler.java:102)
01-02 00:02:25.495 E/AndroidRuntime(  984): at android.os.Looper.loop(Looper.java:148)
01-02 00:02:25.495 E/AndroidRuntime(  984): at android.app.ActivityThread.main(ActivityThread.java:5427)
01-02 00:02:25.495 E/AndroidRuntime(  984): at java.lang.reflect.Method.invoke(Native Method)
01-02 00:02:25.495 E/AndroidRuntime(  984): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1015)
01-02 00:02:25.495 E/AndroidRuntime(  984): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:905)
01-02 00:02:25.495 E/AndroidRuntime(  984): Caused by: android.view.InflateException: Binary XML file line #9: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
01-02 00:02:25.495 E/AndroidRuntime(  984): at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
01-02 00:02:25.495 E/AndroidRuntime(  984): at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
01-02 00:02:25.495 E/AndroidRuntime(  984): at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
01-02 00:02:25.495 E/AndroidRuntime(  984): at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:393)
01-02 00:02:25.495 E/AndroidRuntime(  984): at android.app.Activity.setContentView(Activity.java:2174)
01-02 00:02:25.495 E/AndroidRuntime(  984): at com.skypine.widescreen.tuner.ui.TunerActivity.onCreate(TunerActivity.java:82)
01-02 00:02:25.495 E/AndroidRuntime(  984): at android.app.Activity.performCreate(Activity.java:6258)
01-02 00:02:25.495 E/AndroidRuntime(  984): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
01-02 00:02:25.495 E/AndroidRuntime(  984): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
01-02 00:02:25.495 E/AndroidRuntime(  984): ... 9 more
01-02 00:02:25.495 E/AndroidRuntime(  984): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
01-02 00:02:25.495 E/AndroidRuntime(  984): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:738)
01-02 00:02:25.495 E/AndroidRuntime(  984): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
01-02 00:02:25.495 E/AndroidRuntime(  984): at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
01-02 00:02:25.495 E/AndroidRuntime(  984): at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
01-02 00:02:25.495 E/AndroidRuntime(  984): at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
01-02 00:02:25.495 E/AndroidRuntime(  984): ... 17 more

01-02 00:02:25.499 W/ActivityStack(  412):   Force finishing activity com.skypine.widescreen.tuner/.ui.TunerActivity


定位activity:

setContentView(R.layout.activity_tuner);

这句导致程序崩溃,说出现

activity_tuner.xml出现空指针

定位activity_tuner.xml,发现用了view

    android:layout_width="wrap_content"
    android:layout_height="wrap_content"

android:background="@color/black"/>

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

你可能感兴趣的:(Android)