Status Update
Comments
vi...@google.com <vi...@google.com>
ia...@gmail.com <ia...@gmail.com> #2
FWIW, the View Binding classes are generated correctly (and separate ones for the main
and wearable
modules are correct).
The only issue here is with them resolving correctly in Android Studio.
da...@google.com <da...@google.com> #3
Beautiful bug report, thank you. I'll try to take a look in the nearish future.
da...@google.com <da...@google.com> #4
Hey Ian, it looks like there is no v3.4.0-alpha04
tag. The most recent I see is v3.4.0-alpha03
.
ia...@gmail.com <ia...@gmail.com> #5
Yes, sorry. v3.4.0-alpha03
is the correct tag to look at.
da...@google.com <da...@google.com> #6
Ian, I know you're out until Monday. Maybe we can talk next week? This case seems really ambiguous, that you have two modules with the same package and same layout files. Can you walk me through how the framework resolves this?
ia...@gmail.com <ia...@gmail.com> #7
In this particular case, these modules are entirely independent application modules, so the Android framework isn't involved - as mentioned, the builds themselves work fine as they are two independent builds.
It is just the resolution issue in Studio that is a regression from 3.6.2, which I didn't have this problem on.
da...@google.com <da...@google.com> #8
I see the problem, and a fix + test is in progress.
da...@google.com <da...@google.com> #9
Fix should land in 4.2 Canary 5.
Thanks again Ian for the great repro project and detailed info.
ha...@gmail.com <ha...@gmail.com> #10
da...@google.com <da...@google.com> #11
We've added tests to ensure a Kotlin regression like this won't happen again.
Description
When two independent modules in a project have the same application ID and a layout of the same name, the generated View Binding class is not resolved in the first module, despite the build compiling without issues.
Studio Build: Android Studio 4.1 Beta 2 Build #AI-201.7846.76.41.6604631, built on June 18, 2020
Version of Gradle Plugin: 4.0.0 Version of Gradle: 6.1.1 Version of Java: Runtime version: 1.8.0_242-release-1644-b01 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
OS: Windows 10 10.0
Steps to Reproduce:
v3.4.0-alpha04
tag (this is important as the problem has been worked around in the master branch)ChooseProviderFragment
class in themain
moduleExpected behavior: The
ChooseProviderItemBinding
View Binding class is resolved.Actual behavior: The
ChooseProviderItemBinding
View Binding class is shown in red in Android Studio despite the build compiling fine.Additional information: This seems related to having a layout of the same name and application ID in the
wearable
module (due to how Wear OS apps are built, they share the same application ID as the main app). This can be verified by noting that the other only View Binding class that is not resolved inmain
is theMainActivityBinding
- the only other shared layout name and that renaming the layouts in thewearable
module "fixes" the issue in themain
module.