Intellij android unit tests give java.lang.NoClassDefFoundError -


I've got an Android project for which I'm trying to write unit tests. My Android app has a file called 'command.java' in which my command is class. In my unit tests, I am trying to make some examples of this command class for testing purposes. My unit tests compile fine, but after deploying to the Android simulator, I get the following error: java.lang.NoClassDefFoundError: com.myapp.Command.

It seems that unit tests do not know about the command class during the runtime that I have examined that my Android app is in the form of dependence with 'provider' near the unit test module.

What am I doing wrong here?

"provided" means that the "render" of the dependency of the class that runs the class or by the container , And it should not package dependencies during deployment.

In your case the scope should be "Test" or "Compilation".

If you run your test outside the simulator, then the class is available. To run test cases in the simulator, the code has been packed and the above mentioned rules have been implemented.


Comments