Status Update
Comments
lu...@google.com <lu...@google.com>
je...@google.com <je...@google.com>
so...@google.com <so...@google.com> #2
Actually I believe it would throw a runtime error, not just be redundant:
if (mRecycled) {
throw new RuntimeException(toString() + " recycled twice!");
}
ni...@gmail.com <ni...@gmail.com> #3
Internal note: looks related to Change I39727bc67
[Deleted User] <[Deleted User]> #4
This will be fixed by Change I9baebec66991dd308edda2ce66f1225d25037644 in an upcoming release.
Thank you for the report!
[Deleted User] <[Deleted User]> #5
It seems that due to
sy...@deliveroo.co.uk <sy...@deliveroo.co.uk> #6
Lets say current import in main is `com.something.module.R` then in the test it should be `com.something.module.test.R` and then it works...
[Deleted User] <[Deleted User]> #7
It is perfectly valid to import com.something.module.R
- a .test
package suffix is not required. The issue is that the IDE editor fails to resolve the resource and marks it in a red color, as if it does not exist, which is untrue. Compilation and test execution via Gradle command line works fine.
sm...@google.com <sm...@google.com> #8
This specific case should have been be fixed in recent canaries (from EE Canary 9).
[Deleted User] <[Deleted User]> #9
Will this be fixed in Chipmunk?
[Deleted User] <[Deleted User]> #10
Turns out even the .test
workaround mentioned above does not work in some circumstances. If you use the androidComponents.beforeVariants
AGP DSL to disable unwanted debug library variants, the .test
workaround results in string resources failing to resolve in editor again.
See attached sample project.
This leaves us with very few good choices here. We can do one of the following:
- Use Electric Eel Canary 9 (being forced to use an unstable IDE is a risk)
- Use Chipmunk, but see editor errors in test sources
- Use Chipmunk, but allow unnecessary debug library variants (slows down Gradle builds)
- Not use Kotlin
1.7.x
or AGP7.2.x
+ (cannot upgrade our third-party dependencies that use Kotlin, or take advantage of modern Kotlin features)
I feel this unpleasant situation warrants a backport of the fix to Chipmunk, or at least Dolphin.
ni...@gmail.com <ni...@gmail.com> #11
Fix included in Dolphin RC1 but seems to only fix imports for androidTest
content. Strings still not resolvable for test
content. (Electric Eel not tested yet)
[Deleted User] <[Deleted User]> #12
In our experience, Dolphin RC1 does resolve the issue, but requires invalidating IDE caches, and deleting .idea/modules/*
, .idea/modules.xml
, at least once.
[Deleted User] <[Deleted User]> #13
Ok, so this is FAR from fixed. This issue re-emerges in our project on daily basis.
Android Studio:
Android Studio Electric Eel | 2022.1.1 Beta 2
Build #AI-221.6008.13.2211.9113387, built on September 28, 2022
Runtime version: 11.0.15+0-b2043.56-8887301 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.5.1
GC: PS MarkSweep, PS Scavenge
Memory: 3641M
Cores: 8
Registry:
analyze.exceptions.on.the.fly=true
external.system.auto.import.disabled=true
ide.text.editor.with.preview.show.floating.toolbar=false
Non-Bundled Plugins:
com.intellij.marketplace (221.6008.18)
com.developerphil.adbidea (1.6.8)
izhangzhihao.rainbow.brackets (6.26)
AGP: 7.2.2
Gradle: 7.5.1
[Deleted User] <[Deleted User]> #14
Posted a new issue:
ju...@google.com <ju...@google.com>
sm...@google.com <sm...@google.com>
ju...@google.com <ju...@google.com>
an...@google.com <an...@google.com> #15
Marking this as closed. I am not able to reproduce this on Android Studio Hedgehog. Furthermore, we've recently made changes that address numerous issues related to R
class resolution in both unit tests and android tests, which are present in Studio H and I.
For any new issues that crop up, please feel free to open a new ticket. As always, diagnostic logs (found under "Help > Collect Logs and Diagnostic Data") are helpful to include.
Description
When editing a unit test source of module A, if you reference a string resource like "R.string.foo" from module B, the editor fails to resolve it, marking it as red. The build still works, and the tests run, however.
android.nonTransitiveRClass
isfalse
.Sample project and
idea.log
attached.STEPS TO REPRODUCE:
Studio Build:
Version of Gradle Plugin:
7.2.0
Version of Gradle:
7.3.3
OS:
macOS 12.3.1 (21E258)