Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
[ID: 558956]
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Attachment actions
Description
####################################################
Please provide all of the following information, otherwise we may not be able to route your bug report.
####################################################
1. Describe the bug or issue that you're seeing.
Test fixtures in test-only modules are not correctly recognized by Android Studio due to a source folder issue.
Expected behavior: When using a test-only module (src/main/java for tests as per documentation
Actual behavior: Android Studio shows a red error on the line of code where a test fixture is used within a test-only module. Manually changing the folder src/main/java to "Test sources root" resolves the error, but this is not ideal for version control (git).
Important note: This is a visual error only. Compilation and test execution work correctly despite the red error marking in the editor. The error is specifically a code inspection/IDE error, not a compiler error.
2. Attach log files from Android Studio
No logs from Android Studio but the issue can be reproduced with the sample project attached to this issue
3. If you know what they are, write the steps to reproduce:
3A. Create a new Android project in Android Studio
3B. Add a new test-only module to the project
3C. In the test-only module, create a test class inside src/main/java
3D. In another module, create a test fixture class
3E. Try to reference the test fixture class from your test class in the test-only module
For more information on how to get your bug routed quickly, see
Build: AI-242.23726.103.2422.12816248, 202412180233
AS: Ladybug Feature Drop | 2024.2.2
AI-242.23726.103.2422.12816248, JRE 21.0.4+-12422083-b607.1x64 JetBrains s.r.o., OS Mac OS X(aarch64) v15.1.1, screens 3456x2234 (200%); Retina
Android Gradle Plugin: 8.8.0
Gradle: 8.10.2
Gradle JDK: JetBrains Runtime 21.0.4 - aarch64
NDK: from local.properties: (not specified), latest from SDK: (not found)
CMake: from local.properties: (not specified), latest from SDK: (not found), from PATH: (not found)
```