Why is Android Paint strokeWidth default value suddenly different?

The first thing I see in your code is that nowhere the Paint gets configured or its strokeWidth assigned a value. You need to set specific values and not use defaults, as defaults don't take into consideration display densities neither may have a valid usable value at all.

In the next sniped of your code you instantiate a new Paint instance and use it straight away without setting any properties to it:

private fun DrawGridLines() {
        val paint = Paint()
        for (y in 0..numOfCells) {
             xCanvas!!.drawLine(....
            "Here using already the new paint??? where did you configure it?"

Secondly, notice that Paint.strokeWidth units are in pixels, therefore you need to take into account the device display density and adjust to it.

for example:

val DEFAULT_SIZE_PX = 5.0f
    
val scaledWidth = DEFAULT_SIZE_PX * context
        .resources
        .displayMetrics
        .density
    
paint.strokeWidth = scaledWidth

Or, which is the same as:

val DEFAULT_SIZE_PX = 5.0f
val displayMetrics = context.resources.displayMetrics
val scaledWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, DEFAULT_SIZE_PX, displayMetrics)
paint.strokeWidth = scaledWidth