R.id.* is not recognized any more after upgrade to Gradle 8.3.2 and gradle-8.4-bin.zip

  Kiến thức lập trình

After upgrading to gradle 8.3.2 and gradle-8.4-bin.zip, I am getting this error in Android Studio:

Error: constant expression required

then, fouind this link: constant expression required when trying to create a switch case block and apply this in the gradle.properties file and the error is gone:

android.nonFinalResIds=false

but for those layout file where material UI is used:

<com.google.android.material.textfield.TextInputLayout
            android:id="@+id/myId" .../>

the id within TextInputLayout is not recognized any more, e.g:

binding.myId.findViewById(R.id.text_input_end_icon)

I have to append the full path to make it recognized again:

binding.myId.findViewById(com.google.android.material.R.id.text_input_end_icon)

I tried to do import like this after my app’s own R import:

import com.google.android.material.R.id.*;

but it shows it’s greyed which means not in use at all. I don’t want to add this prefix everywhere in the code base. Any hints will be highly appreciated!

Thanks
Shawn

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT