Android Kotlin evita passar nulo como a view root alertdialog
builder.setView(View.inflate(this, R.layout.dialog, null))
Slashcode
builder.setView(View.inflate(this, R.layout.dialog, null))