0

I got this error when I used evosuite to generate test cases with my android project.

In the beginning, there was such an error:“can not find this class:android.support.v7.widget.Toolbar” I solved this problem by adding Android's jar package:collections-28.0.0.jar into CP path, and then the following error occurred in the process of automatically generating use cases for multiple files:

[MASTER] 21:22:39.979 [logback-2] ERROR TestClusterGenerator - Problem for com.rapidapp.base.account.AppBaseService. Failed to add dependencies for class android.support.v7.widget.Toolbar: java.lang.NoClassDefFoundError: android/support/v7/widget/Toolbar$SavedState [java.lang.Class.getDeclaringClass0(Native Method), java.lang.Class.getDeclaringClass(Class.java:1235), java.lang.Class.getEnclosingClass(Class.java:1277), java.lang.Class.getSimpleBinaryName(Class.java:1443), java.lang.Class.getSimpleName(Class.java:1309), java.lang.Class.isAnonymousClass(Class.java:1411), org.evosuite.setup.TestUsageChecker.canUse(TestUsageChecker.java:155), org.evosuite.setup.TestUsageChecker.canUse(TestUsageChecker.java:338), org.evosuite.setup.TestClusterGenerator.addDependencyClass(TestClusterGenerator.java:975), org.evosuite.setup.TestClusterGenerator.resolveDependencies(TestClusterGenerator.java:358), org.evosuite.setup.TestClusterGenerator.generateCluster(TestClusterGenerator.java:137), org.evosuite.setup.DependencyAnalysis.analyze(DependencyAnalysis.java:118), org.evosuite.setup.DependencyAnalysis.analyzeClass(DependencyAnalysis.java:132), org.evosuite.TestSuiteGenerator.initializeTargetClass(TestSuiteGenerator.java:110), org.evosuite.TestSuiteGenerator.generateTestSuite(TestSuiteGenerator.java:130), org.evosuite.rmi.service.ClientNodeImpl$1.run(ClientNodeImpl.java:145), java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511), java.util.concurrent.FutureTask.run(FutureTask.java:266), java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142), java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617), java.lang.Thread.run(Thread.java:745)]

Finally, a use case is not generated.

PX Cheng
  • 101
  • 1
  • 6

1 Answers1

0

I have experienced This exception before, when (trying) to run code which had been compiled on one operating system on another. Also, when updates have occurred to the OS.

Though you might have thought that backwards compatibility should remove this later, it is not always the case!

Bill Naylor
  • 482
  • 1
  • 9
  • 14
  • From what I can recall, the first time we encountered this it was due to migrating a system to new architecture. The functionality was determined to be dangerous and was deprecated. The second time, an automatic update of the OS had been performed by puppet the (web) server was still running, but the ground had changed under its feet (so to speak) and just needed to be restarted. In your case, I can't say as I have no experience with evosuite or android. – Bill Naylor Mar 25 '19 at 08:24
  • Thank you anyway, I will continue to find a solution, and I will synchronize it here when I find it. – PX Cheng Mar 25 '19 at 11:57