CI环境中的机器人



>我遇到了一个问题,我的机器人测试在我的终端中通过: ./gradlew test使用Circleci上的所有工具正确配置的相同命令给了我此错误:

java.lang.RuntimeException: java.lang.IllegalArgumentException: maxSize <= 0
        at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:238)
        at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:185)
        at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:54)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:149)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:86)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:49)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69)
        at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:48)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
        at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
        at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
        at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
        at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:105)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
        at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:360)      
        at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: maxSize <= 0
        at com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache.<init>(LruMemoryCache.java:33)
        at com.nostra13.universalimageloader.core.DefaultConfigurationFactory.createMemoryCache(DefaultConfigurationFactory.java:114)
        at com.nostra13.universalimageloader.core.ImageLoaderConfiguration$Builder.initEmptyFieldsWithDefaultValues(ImageLoaderConfiguration.java:584)
        at com.nostra13.universalimageloader.core.ImageLoaderConfiguration$Builder.build(ImageLoaderConfiguration.java:559)
        at com.heetch.HeetchApp.initImageLoader(HeetchApp.java:123)
        at com.heetch.HeetchApp.onCreate(HeetchApp.java:55)
        at org.robolectric.internal.ParallelUniverse.setUpApplicationState(ParallelUniverse.java:140)
        at org.robolectric.RobolectricTestRunner.setUpApplicationState(RobolectricTestRunner.java:421)
        at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:234)
        ... 34 more
我正在使用 robolectric

3.0-rc3,我相信这个错误来自 robolectric 本身,但我没有任何线索可以在哪里寻找来解决此错误。

解决方案是将内存缓存添加到ImageLoader,如下所示:

ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
                .memoryCache(new WeakMemoryCache())
                .build();

相关内容

  • 没有找到相关文章

最新更新