
I tried to set background for LinearLayout, I used code setBackgroundResource() but it has error. Please help me, thanks.

I tried to set background for LinearLayout, I used code setBackgroundResource() but it has error. Please help me, thanks.
Try to clean and rebuild your project.
If that doesn't work, use this code to set the background
linearLayout.setBackground(ContextCompat.getDrawable(this, R.drawable.img1))
By the way, next time you should post the code directly instead of passing in a link.
This happens common when you add the resource to another locale, let's say you have two locales, one is fr (French) and the other is the default en. When you put the image resource in the fr locale and run the app with the default locale, you will see this crash.