I'm trying out AS flamingo and updated to AGP `8.0...
# android
s
I'm trying out AS flamingo and updated to AGP
8.0.0-beta01
. now I have to use the correct import for the R class when a resource is in a different module. is this intended? normally, one can use the R of the current module and get access to all other resources in all other modules automatically. it's now
com.example.text.R.string.
instead of
R.string.
(with
import com.example.ui.R
)
😶 2
you can import multiple
R
classes at the same time, as long as you give them different aliases
Copy code
import com.example.text.R as TextR
import com.example.ui.R

findViewById<TextView>(R.id.foo).text = getString(TextR.string.bar)
1
👍 1
s
ah, perfect. there's a wizard for it (already did it manually across 800 files 😄) https://developer.android.com/studio/build/optimize-your-build#use-non-transitive-r-classes THX!
what if the option is grayed out?
e
I don't know, I migrated my codebase to non-transitive R classes years ago, without the wizard. but possibly it sees that the value is already set to
true
(by defaults changed in AGP 8.0) so there's nothing to migrate, maybe if it were explicitly
false
it would offer to run the wizard?
s
yes, that's it. setting
android.nonTransitiveRClass=false
enables this option