Cha*_*ave 5 java android android-studio
当我尝试使用 Android Studio 4.0 运行 Instrumentation 测试时,我得到
Caused by: java.lang.IllegalStateException: Unexpected non-class file: META-INF\versions\9\org\junit\platform\commons\util\ModuleUtils$ModuleReferenceScanner.class
Run Code Online (Sandbox Code Playgroud)
直到我将 Android Studio 从 3.x 升级到 4.0 才发生这种情况。
有人解决了吗?提前致谢。
Dam*_*rek -1
这是我想出的解决问题的方法...我认为不需要这些类文件,删除它们似乎不会引起任何问题。
/**
* Hack to work around this problem: /sf/ask/4377827751/
* I don't think we use these class files at all so we can just delete them before dexing. I tried to see if we could
* configure the file collection to exclude them instead, but it's actually just a collection of folders, which
* internally the task just traverses separately.
*/
allprojects {
tasks.withType<DexArchiveBuilderTask> {
doFirst {
mixedScopeClasses
.asFileTree
.matching { include("**/META-INF/versions/9/**/*.class") }
.forEach { it.delete() }
}
}
}
Run Code Online (Sandbox Code Playgroud)
(这是 Kotlin - 如果你使用 Groovy 会略有不同)
| 归档时间: |
|
| 查看次数: |
414 次 |
| 最近记录: |