我似乎无法获得测试文件来查找Junit4.我一直在努力,但感到沮丧.它说在组织下找不到符号junit.我搜索过的所有内容(几天),甚至android文档都说这是做到这一点的方法.我究竟做错了什么?
这是我的考试课
import org.junit.Test;import androID.app.Application;public class ApplicationTest { // @Test public Applicationtest() { }}
这是我的build.gradle
apply plugin: 'com.androID.application'androID { compileSdkVersion 21 //buildToolsversion "21.1.2" buildToolsversion "22.0.1" defaultConfig { applicationID "stuff.morestuffs" minSdkVersion 19 targetSdkVersion 21 versionCode 1 versionname "1.0" } buildTypes { release { MinifyEnabled false proguardfiles getDefaultProguardfile('proguard-androID.txt'), 'proguard-rules.pro' } deBUG { deBUGgable true } }}dependencIEs { compile filetree(include: ['*.jar'], dir: 'libs') compile 'com.androID.support:appcompat-v7:21.0.3' compile files('libs/gson-2.3.1.jar') testCompile 'junit:junit:4.12'}
这是我的项目build.gradle
buildscript { repositorIEs { jcenter() } dependencIEs { classpath 'com.androID.tools.build:gradle:1.3.0' // NOTE: Do not place your application dependencIEs here; they belong // in the indivIDual module build.gradle files }}allprojects { repositorIEs { jcenter() }}
我正在使用AndroID Studio 1.4
解决方法:
>对于单元测试(JVM测试),根源目录应该是test,而不是AndroID仪器测试的androIDTest.
>在“构建变体”下,选择了“ AndroID乐器测试”.当我将其更改为“单元测试”时,AndroID Studio可以正确识别我的文件.
以上是内存溢出为你收集整理的Android Studio找不到JUnit套件全部内容,希望文章能够帮你解决Android Studio找不到JUnit套件所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)