Elijah Atuhaire
Elijah Atuhaire

Reputation: 195

Error:(3, 17) java: package org.junit does not exist- intellij

I recently started using IntelliJ to build my android application project. I imported my sherlock library as a module and added the dependency to my project. However when I try to rebuild my project to check any errors I get a lines of 10 errors like this:

Error:(3, 17) java: package org.junit does not exist
Error:(4, 24) java: package org.junit.runner does not exist
Error:(5, 23) java: package org.robolectric does not exist
Error:(7, 38) java: package org.fest.assertions.api does not exist
Error:(7, 1) java: static import only from classes and interfaces
Error:(9, 2) java: cannot find symbol
  symbol: class RunWith
Error:(11, 6) java: cannot find symbol
  symbol:   class Test
  location: class com.actionbarsherlock.internal.ResourcesCompatTest
Error:(13, 20) java: cannot find symbol
  symbol:   method cleanActivityName(java.lang.String,java.lang.String)
  location: class com.actionbarsherlock.internal.ResourcesCompatTest
Error:(15, 20) java: cannot find symbol
  symbol:   method cleanActivityName(java.lang.String,java.lang.String)
  location: class com.actionbarsherlock.internal.ResourcesCompatTest
Error:(17, 19) java: cannot find symbol
  symbol:   method cleanActivityName(java.lang.String,java.lang.String)
  location: class com.actionbarsherlock.internal.ResourcesCompatTest

Upvotes: 12

Views: 14579

Answers (3)

sivi
sivi

Reputation: 11114

You can check if the plugin is installed. If it is, it is just a matter of adding it to your class path. You can do it automatically by selecting the JUnit word and then press on the inspection left side yellow bulb choose "add JUnit to classpath".

Upvotes: 3

skk
skk

Reputation: 1

Adding below line in build.gradle solved the problem...

compile 'com.android.support.test:runner:0.5'

Upvotes: 0

Jens
Jens

Reputation: 69450

looks like the junit.jar is missing in your classpath. Add it and it should work.

Upvotes: 7

Related Questions