吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1683|回复: 0
收起左侧

[其他转载] AS升级arctic fox后报Test events were not received

[复制链接]
yuhangyuanyuan 发表于 2022-1-16 12:18
1. 使用 Android Studio Arctic fox 要使用JUnit5 测试,需要添加一些依赖项:junit-platform-launcher、junit-platform-engine等
测试类中的@Test导入为import org.junit.jupiter.api.Test
gradle build:
[Java] 纯文本查看 复制代码
android {

testOptions {

    execution 'ANDROIDX_TEST_ORCHESTRATOR'

    unitTests.all {

        useJUnitPlatform() // <--- this is the important part

    }

}

依赖:
[Java] 纯文本查看 复制代码
 
dependencies { 

    testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.7.1'

    //testImplementation 'junit:junit:4.+'  // should get rid of this old JUnit.

    testImplementation 'org.junit.vintage:junit-vintage-engine' //Let's Jupiter do the right thing when encountering a @RunWith(RobolectricTestRunner::class)

}

https://stackoverflow.com/questions/68851779/android-studio-arctic-fox-incompatible-with-junit4
2. 若仍有Test events were not received报错
可能是由于jacoco而发生的。最新的 Android Studio Arctic fox 带有 Java 11,但我们使用的是 Java 1.8(或其他低版本)。需要添加:
jacoco.excludes = ['jdk.internal.*']
https://stackoverflow.com/questions/68737413/noclassdeffounderror-on-running-unit-test-after-updating-android-studio-to-artic

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-4-24 13:27

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表