Fixed
Status Update
Comments
gh...@google.com <gh...@google.com> #2
We have shared this with our product and engineering team and will update this issue with more information as it becomes available.
gh...@google.com <gh...@google.com> #3
Actually, I think I found the cause. The full stack trace will probably not be needed.
gh...@google.com <gh...@google.com> #4
Reproducible in a multi-module project with the following code snippet (which triggers a particular code path in PrivateApiDetector
):
val activityClass = Class.forName("android.app.Activity")
val bundleClass = Class.forName("android.os.Bundle")
val method = activityClass.getDeclaredMethod("dispatchActivityPostCreated", bundleClass)
The root cause is that PrivateApiDetector
caches the ideaProject
here:
override fun beforeCheckRootProject(context: Context) {
...
psiFactory = PsiElementFactory.getInstance(context.project.ideaProject)
}
and this caching is invalid when lint.do.not.reuse.uast.env
is enabled.
I'm hoping to create a fix in time for AGP 4.2.2.
gh...@google.com <gh...@google.com> #5
The fix, Change Ib7d4d6c9e, should land in AGP 4.2.2.
And to confirm, lint.do.not.reuse.uast.env
should no longer be needed at all in AGP 7.0+.
Thank you for the report!
Description
AGP 4.2.0
As suggested in https://issuetracker.google.com/issues/158777858#comment22 , we tried to turn on
systemProp.lint.do.not.reuse.uast.env=true
to work around the bug in that issue.That gave us a new error which does not happen without this workaround: