Exception in thread “main” java.lang.NoClassDefFoundError: junit/textui/ResultPrinter

前端 未结 8 1211
长发绾君心
长发绾君心 2020-12-03 06:35

I\'m trying to compile my Android project in Android Studio 0.3.0. Today I get the following error:

Exception in thread \"main\" java.lang.NoClassDefFoundErr         


        
8条回答
  •  悲哀的现实
    2020-12-03 06:48

    For standard JUnit tests, you are missing the JUnit library, try adding this in build.gradle:

    dependencies {
        ...
        testCompile 'junit:junit:4.12'
        ...
    }
    

    And make sure you are putting the tests in the "test" directory parallell to the "main" package (instrumentation tests goes into "androidTest", but that is different setup).

提交回复
热议问题