Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crash when using simple view in layout

See original GitHub issue

Hi, using simple view in my layout i have a crash when i inflating layout. Can you fix this bug?

Thanks, Matteo Sist

Stacktrace: 09-24 11:40:48.927 20785-20785/ E/AndroidRuntime﹕ FATAL EXCEPTION: main Process:, PID: 20785 android.view.InflateException: Binary XML file line #21: Attempt to invoke virtual method ‘boolean java.lang.String.equals(java.lang.Object)’ on a null object reference at android.view.LayoutInflater.inflate( at at android.view.LayoutInflater.inflate( at at at at at at at$ at android.os.Handler.handleCallback( at android.os.Handler.dispatchMessage( at android.os.Looper.loop( at at java.lang.reflect.Method.invoke(Native Method) at$ at Caused by: java.lang.NullPointerException: Attempt to invoke virtual method ‘boolean java.lang.String.equals(java.lang.Object)’ on a null object reference at android.view.LayoutInflater.createViewFromTag( at android.view.LayoutInflater.createViewFromTag( at android.view.LayoutInflater.rInflate( at android.view.LayoutInflater.rInflateChildren( at android.view.LayoutInflater.rInflate( at android.view.LayoutInflater.rInflateChildren( at android.view.LayoutInflater.inflate(             at             at android.view.LayoutInflater.inflate(             at             at             at             at             at             at             at$             at android.os.Handler.handleCallback(             at android.os.Handler.dispatchMessage(             at android.os.Looper.loop(             at             at java.lang.reflect.Method.invoke(Native Method)             at$             at


public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_picture_preview, container, false);
    return view;


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android=""

    android:layout_above="@+id/lc_pictureNavigationBar" />


    <!--view cause of crash-->
        android:layout_weight="2" />

        android:textSize="30sp" />



Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

d-rahulcommented, Jan 22, 2018

I encountered this same issue in Activity also when I used view instead of View tag. But found a solution from You can found many more Android tricks and solutions from here:

chrisjenxcommented, Sep 24, 2015

@matteo-adsolutions nothing to do with Calligraphy, you can’t just inflate a view like that. I use Space and View all the time in similar situations. If you remove Calligraphy you will see the same crash.

Read more comments on GitHub >

github_iconTop Results From Across the Web

android xml, crash of the custom view in a layout
You are trying to build the view from layout xml passing parameters,but you don't have any constructor that can receive them.
Read more >
Layout view crashing ArcMap? - arcgis desktop
I'm using ArcMap 10.3.1 from a basic desktop concurrent use license. The problem I'm experiencing occurs when I load an existing mxd ...
Read more >
Layout crashing Vector Rendering - SketchUp Community
Hi All, I'm having problems rendering a file in layout from raster to vector. I've gone through some of the trouble shooting in...
Read more >
Crash with List using Observable Object - Apple Developer
Hello,. I'm using swiftUI to render my interface, the goal is to made a simple tableView. I'm using List, passing a param that...
Read more >
Auto Layout Crashes on iOS - Embrace Blog and Events
Without defining constraints, developers can also use stack views for simple layouts that follow inherent object sizes and attributes such ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found