! JUnit版本3.8或更高版本的预期 [英] !!! JUnit version 3.8 or later expected

查看:463
本文介绍了! JUnit版本3.8或更高版本的预期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Andr​​oid Studio项目具有程序模块,它是Android框架依赖,我已经创造了新的模块称为域并且只包含纯Java类和一些测试类。 在这个模块的build.gradle文件我已经添加了JUnit和的Mockito库用于测试用途如下:

My Android studio project has app module which is android framework dependent, I have created new module called domain and contains only pure java classes and few test classes. in this module's build.gradle file i have added junit and mockito libraries for testing purpose as follows:

    apply plugin: 'java'
sourceCompatibility = 1.7
targetCompatibility = 1.7
dependencies {
    testCompile 'junit:junit:4.11'
    testCompile 'org.mockito:mockito-core:1.9.5'
    compile project(':common')
    compile project(':model')
    //test dependencies
}

但作为给我的! JUnit版本3.8或更高版本预计错误消息,每当我试图执行测试类。

But AS giving me !!! JUnit version 3.8 or later expected error message whenever i try to execute test class.

所有建议的解决方案这个问题是打开的项目结构|模块|相关性,并移动的junit-4.7.jar起来,让涉及的Andr​​oid 1.6平台的类路径之前。

All the suggested solutions to this problem is to open the Project Structure | Modules | Dependencies, and move the junit-4.7.jar up, so that it comes before Android 1.6 Platform in the classpath.

其实,我试图实施这一解决方案,但问题依然存在

in fact, i have tried to implement this solution but the problem is still exist

在如何解决这个问题?任何想法

Any idea on how to resolve this issue?

推荐答案

我设法解决这个问题,通过改变.iml文件中的以下

I managed to solve the problem by by changing the following in .iml file

从:

 <component name="NewModuleRootManager" inherit-compiler-output="true">

  <orderEntry type="inheritedJdk" />

这篇关于! JUnit版本3.8或更高版本的预期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆