我正在尝试用Scala编写仪器测试(完整代码在这里)。
您知道java.lang.IncompatibleClassChangeError: Couldn't find scala.reflect.ScalaSignature.bytes
运行时错误的原因吗?
我试图保持scala.reflect.ScalaSignature.bytes
在build.sbt
:
proguardOptions ++=
"-dontwarn android.test.**" ::
"-dontwarn org.scalatest.**" ::
"-dontwarn scala.xml.**" ::
"-dontwarn slick.jdbc.**" ::
"-dontwarn org.slf4j.**" ::
"-dontwarn org.junit.**" ::
"-dontobfuscate" ::
"-dontnote ** " ::
"-dontpreverify" ::
"-optimizations !code/simplification/arithmetic" ::
"-keep class android.support.test.** { *; }" ::
"-keep class scala.reflect.ScalaSignature.** {*;}" ::
"-keep class com.mypackage.** { *; }" ::
"-keep class * extends junit.framework.TestCase { *; }" ::
"-keepclasseswithmembers class * { @org.junit.** *; }" ::
"-keepclassmembers class * { ** bytes();}"::
"-keep class android.support.test.** { *; }" ::
"-keep class org.junit.** { *; }" ::
Nil
但它似乎没有帮助。
全栈跟踪:
E ( 9562) TestExecutor: Fatal exception when running tests
E ( 9562) TestExecutor: java.lang.IncompatibleClassChangeError: Couldn't find scala.reflect.ScalaSignature.bytes
E ( 9562) TestExecutor: at libcore.reflect.AnnotationAccess.toAnnotationInstance(AnnotationAccess.java:659)
E ( 9562) TestExecutor: at libcore.reflect.AnnotationAccess.annotationSetToAnnotations(AnnotationAccess.java:633)
E ( 9562) TestExecutor: at libcore.reflect.AnnotationAccess.getDeclaredAnnotations(AnnotationAccess.java:161)
E ( 9562) TestExecutor: at libcore.reflect.AnnotationAccess.getAnnotations(AnnotationAccess.java:111)
E ( 9562) TestExecutor: at java.lang.Class.getAnnotations(Class.java:369)
E ( 9562) TestExecutor: at org.junit.runner.Description.createSuiteDescription(Description.java:124)
E ( 9562) TestExecutor: at org.junit.internal.runners.ErrorReportingRunner.getDescription(ErrorReportingRunner.java:28)
E ( 9562) TestExecutor: at org.junit.runners.Suite.describeChild(Suite.java:123)
E ( 9562) TestExecutor: at org.junit.runners.Suite.describeChild(Suite.java:27)
E ( 9562) TestExecutor: at org.junit.runners.ParentRunner.shouldRun(ParentRunner.java:434)
E ( 9562) TestExecutor: at org.junit.runners.ParentRunner.filter(ParentRunner.java:382)
E ( 9562) TestExecutor: at org.junit.runner.manipulation.Filter.apply(Filter.java:97)
E ( 9562) TestExecutor: at android.support.test.internal.runner.TestRequestBuilder$LenientFilterRequest.getRunner(TestRequestBuilder.java:381)
E ( 9562) TestExecutor: at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
E ( 9562) TestExecutor: at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:59)
E ( 9562) TestExecutor: at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:262)
E
-keep class scala.reflect.ScalaSignature {*;}
No **