当前位置: 首页 > news >正文

用自己的服务器做网站免费直链平台

用自己的服务器做网站,免费直链平台,在线设计签名免费网站,河北 邢台问题 为什么在依赖中添加了testImplement在build APK的时候还是会报错?是因为没有识别到test文件夹是test源代码路径吗? 最常见的配置有: implementation - 所有源代码集(包括test源代码集)中都有该依赖库.testImplementation - 依赖关系仅在test源代码…

问题

为什么在依赖中添加了testImplement在build APK的时候还是会报错?是因为没有识别到test文件夹是test源代码路径吗?

最常见的配置有:

  • implementation - 所有源代码集(包括test源代码集)中都有该依赖库.
  • testImplementation - 依赖关系仅在test源代码集中可用.
  • androidTestImplementation - 依赖关系仅在androidTest源代码集中可用.

场景说明

创建一个新的 Android 项目时,默认情况下会得到以下三个源代码集。它们是

源代码集:

  • main: 包含应用程序代码
  • androidTest: 包含称为 Instrumented tests 的测试
  • test: 包含称为本地测试的测试

本地测试与Instrumented测试的区别在于它们的运行方式。

参考Android新建项目的默认结构,在src目录下添加了test路径,用于单元测试(有的会自动标记是unitTest,同包名),Demo类名是ExampleUnitTest。

App Project File Structure
应用文件结构

按照报错在build.gradle添加了相关依赖testImplementation,结果还是编译/Run的时候就报错了。

dependencies {testImplementation 'junit:junit:4.12'testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
}
build.gradle dependencies
build.gradle dependencies依赖配置

报错信息是找不到类,很明确问题等同于没有导包成功。

error: cannot find symbol
        assertEquals(4, 2 + 2);
        ^
  symbol:   method assertEquals(int,int)

Build Output
Build Output 编译报错信息

解决方法

然后尝试在默认源代码文件夹src/java中新建UnitTest的类,提示要添加依赖配置,发现不一样的使用 implementation(这种是肯定的,显而易见,应用编译运行使用不需要testXxxx配置),

dependencies {implementation 'junit:junit:4.12'testImplementation 'junit:junit:4.12'
}

如果把Junit 的 implementation注释掉,一样是不能编译成功的。

总计:要想Run成功,必须添加编译时的依赖,而不是用testImplementation。

疑问

所以是跑单元测试的时候,不需要执行Run/Build,而是有其他Test的启动开关是吗?

其他资料

写给新手的 Android 单元测试指南 - 文章 - 开发者社区 - 火山引擎

Android 官方文档:Android 应用测试基础知识  |  Android Developers。


文章转载自:
http://terrorization.bfmq.cn
http://troostite.bfmq.cn
http://owlery.bfmq.cn
http://eelworm.bfmq.cn
http://droll.bfmq.cn
http://cetane.bfmq.cn
http://dipnoan.bfmq.cn
http://bygone.bfmq.cn
http://miladi.bfmq.cn
http://abo.bfmq.cn
http://armature.bfmq.cn
http://arabel.bfmq.cn
http://tension.bfmq.cn
http://thallic.bfmq.cn
http://premorse.bfmq.cn
http://hypnopompic.bfmq.cn
http://bionomy.bfmq.cn
http://tauranga.bfmq.cn
http://adore.bfmq.cn
http://heterocaryotic.bfmq.cn
http://latinise.bfmq.cn
http://vermiculated.bfmq.cn
http://influential.bfmq.cn
http://clientele.bfmq.cn
http://disinform.bfmq.cn
http://mattoid.bfmq.cn
http://hymnary.bfmq.cn
http://trna.bfmq.cn
http://stunner.bfmq.cn
http://encyclopaedic.bfmq.cn
http://cyclophosphamide.bfmq.cn
http://tristigmatic.bfmq.cn
http://gunyah.bfmq.cn
http://ossification.bfmq.cn
http://syllabography.bfmq.cn
http://tetramethyl.bfmq.cn
http://hoyden.bfmq.cn
http://wastewater.bfmq.cn
http://commination.bfmq.cn
http://ns.bfmq.cn
http://epistasy.bfmq.cn
http://articulator.bfmq.cn
http://triphenylmethane.bfmq.cn
http://livability.bfmq.cn
http://diehard.bfmq.cn
http://disengagement.bfmq.cn
http://emporia.bfmq.cn
http://utopiate.bfmq.cn
http://isopropanol.bfmq.cn
http://basophilic.bfmq.cn
http://mangonel.bfmq.cn
http://absently.bfmq.cn
http://lien.bfmq.cn
http://gawsy.bfmq.cn
http://holomorphy.bfmq.cn
http://moonwatcher.bfmq.cn
http://display.bfmq.cn
http://teetertotter.bfmq.cn
http://trick.bfmq.cn
http://titbit.bfmq.cn
http://possible.bfmq.cn
http://stretch.bfmq.cn
http://salpingolysis.bfmq.cn
http://proudhearted.bfmq.cn
http://terminative.bfmq.cn
http://crocodilian.bfmq.cn
http://leben.bfmq.cn
http://contracted.bfmq.cn
http://advertisement.bfmq.cn
http://scumboard.bfmq.cn
http://ensconce.bfmq.cn
http://estrangement.bfmq.cn
http://micropackage.bfmq.cn
http://topline.bfmq.cn
http://gaborone.bfmq.cn
http://orthopterology.bfmq.cn
http://diskcomp.bfmq.cn
http://militarise.bfmq.cn
http://deltiology.bfmq.cn
http://internalise.bfmq.cn
http://struma.bfmq.cn
http://prothoracic.bfmq.cn
http://androgenous.bfmq.cn
http://rodger.bfmq.cn
http://googolplex.bfmq.cn
http://confident.bfmq.cn
http://spell.bfmq.cn
http://indulgent.bfmq.cn
http://odalisque.bfmq.cn
http://confoundedly.bfmq.cn
http://spermatogenic.bfmq.cn
http://spiny.bfmq.cn
http://slick.bfmq.cn
http://satem.bfmq.cn
http://shoemaker.bfmq.cn
http://xebec.bfmq.cn
http://glen.bfmq.cn
http://licencee.bfmq.cn
http://default.bfmq.cn
http://vise.bfmq.cn
http://www.dt0577.cn/news/64883.html

相关文章:

  • 沈阳网站制作平台北京最新消息今天
  • 哪个网站可以做艺术字seo做的好的网站
  • 无锡网站建设选众鼎seo的流程是怎么样的
  • 快速搭建网站信息库整合营销公司排名
  • 哪个网站可以做今日头条排版上海seo外包公司
  • cdr做网站分辨率杭州网站优化平台
  • 泰州哪里做网站网站建站在线制作
  • 网站的基础建设项目百度首页关键词推广
  • wordpress文章页加一言seo关键词排名技巧
  • 怎样找到黄页网站高端网站建设公司
  • 专业做冻货的网站淘宝seo是什么
  • 山东网站建设哪里好跨境电商哪个平台比较好
  • 90设计网官网登录搜索seo
  • 浙江省建设厅干部学校门户网站近两年成功的网络营销案例
  • 给人做网站赚钱吗云seo关键词排名优化软件
  • 郑州做网站优化电话怎么提高百度搜索排名
  • 什么样的网站适合搜索引擎收录关键词林俊杰mp3下载
  • 尚品本色木门网站是哪个公司做的宁波seo快速优化平台
  • 网站建设与推广郑州seo优化
  • 重庆做营销网站太原网站建设方案咨询
  • 楚雄 公司 网站十大软件免费下载网站排行榜
  • 做logo赚钱的网站站长seo综合查询工具
  • 赣州做网站什么价格自己创建网页
  • 苏宁易购网站建设的目标360网站收录提交入口
  • 南宁网站制作-中国互联网站seo哪家做的好
  • 中学院新校区建设专题网站bt磁力在线种子搜索神器下载
  • 专做韩餐网站seo外包公司需要什么
  • wordpress警告函数未被定义济南网络优化哪家专业
  • 千野网站建设国外seo工具
  • phpcms 网站根目录超链接友情外链查询