我最近开始使用IntelliJ来构建我的android应用程序项目。我将sherlock库导入为模块,并将依赖项添加到我的项目中。但是,当我尝试重建我的项目来检查任何错误时,我会收到10行错误:
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
答案 0 :(得分:7)
看起来类路径中缺少junit.jar
。添加它,它应该工作。
答案 1 :(得分:2)
你可以查看插件是否已安装。只需将它添加到类路径,你可以通过选择junit字自动完成,然后按检查左侧黄色灯泡选择“添加junit到类路径”
答案 2 :(得分:0)
在build.gradle中添加以下行解决了问题......
编译' com.android.support.test:runner:0.5'