JUnit4 library not found in the module - Android Studio

Viewed 18

Recently, I started facing a weird issue. Whenever I am trying to add a test case through the shortcut in Android Studio, the following warning:

enter image description here

"JUit library not found in the module"

If I go ahead with adding the test case, the test case gets added to the main source set.

When I try to move the test case manually to the test source set, I face a weird issue where the test classes are unable to resolve the classes in the main source set. Classes from any other library (imported from artifactory) are successfully resolved.

One more thing, if I create a fresh Android Project, I don't face any issues. It is only with the imported projects, I face the issue.

Has anyone faced this issue recently?

Details for the Android Studio version I am using:

Android Studio Chipmunk | 2021.2.1 Patch 2
Build #AI-212.5712.43.2112.8815526, built on July 10, 2022
Runtime version: 11.0.12+0-b1504.28-7817840 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 11.6.8
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 12
Registry: external.system.auto.import.disabled=true
0 Answers
Related