Getting Class not found in module 'app'
Solution 1
I had a similar issue trying to run a groovy test suite.
Try right clicking the java
directory under src/androidTest/java
and choosing mark directory as -> test sources root
Solution 2
I had the same problem and had to look for this for a little bit, and here is what I found.
Go to Run -> Edit Configuration ...
to open Run/Debug Configurations
.
From there you can either modify your current configurations (whether for JUnit, Android Tests, or Android Application), or you can add a new one as you need. I am sure you can change the class name there.
![Vikram](https://lh5.googleusercontent.com/-0TwuFaQ3AQY/AAAAAAAAAAI/AAAAAAAAAqQ/sjaKh8ZvaBM/photo.jpg?sz=256)
Vikram
Want to create some impact on society using technology which will make people's life more easier. I love to work on exciting projects.
Updated on August 29, 2022Comments
-
Vikram almost 2 years
I'm getting below error while unit testing-
Exception in thread "main" java.lang.NoClassDefFoundError: junit/textui/ResultPrinter at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:191) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:116) Caused by: java.lang.ClassNotFoundException: junit.textui.ResultPrinter at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
Project structure is-
After some investigation in Run Configuration came to know its taking wrong module(main.java.com.example.dexter.sunshine.app) while running this unit case. How can we change this module?
-
Gangnus over 8 yearsExcellent. I would add, that we should use the mark directory as source root command, too, for the root of the tested files. stackoverflow.com/a/36057080/715269.