找不到名称

时间:2015-08-13 14:14:45

标签: android mockito build.gradle powermock

我使用gradle 2.2.1在Android Studio 1.3.1上工作。 我的应用程序是在eclipse上创建的,然后转移到AS。我正在使用Mockito,PowerMock和JUnit进行测试。我遇到了 ProxyFrameworkImpl 的问题,我确信我的jar包含这个类 - 我在外部库部分的项目资源管理器中找到了它。

从调试记录:

java.lang.IllegalStateException: Extension API internal error: org.powermock.api.extension.proxyframework.ProxyFrameworkImpl could not be located in classpath.
at org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.registerProxyframework(AbstractTestSuiteChunkerImpl.java:142)
at org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.chunkClass(AbstractTestSuiteChunkerImpl.java:173)
at org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.<init>(AbstractTestSuiteChunkerImpl.java:92)
at org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.<init>(AbstractTestSuiteChunkerImpl.java:85)
at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.<init>(JUnit4TestSuiteChunkerImpl.java:49)
at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.<init>(AbstractCommonPowerMockRunner.java:32)
at org.powermock.modules.junit4.PowerMockRunner.<init>(PowerMockRunner.java:34)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at android.support.test.internal.runner.junit4.AndroidAnnotatedBuilder.runnerForClass(AndroidAnnotatedBuilder.java:51)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runner.Computer.getRunner(Computer.java:40)
at org.junit.runner.Computer$1.runnerForClass(Computer.java:31)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:101)
at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:87)
at org.junit.runners.Suite.<init>(Suite.java:81)
at org.junit.runner.Computer.getSuite(Computer.java:28)
at android.support.test.internal.runner.TestRequestBuilder.classes(TestRequestBuilder.java:598)
at android.support.test.internal.runner.TestRequestBuilder.build(TestRequestBuilder.java:578)
at android.support.test.runner.AndroidJUnitRunner.buildRequest(AndroidJUnitRunner.java:542)
at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:269)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1837)

我的gradle.build文件中的依赖项包括带有powermock,mockito,junit和espresso的罐子:

    compile fileTree(include: '*.jar', dir: 'libs')
    compile project(':google-play-services_lib')
    compile('junit:junit:4.12') {
        exclude group: 'org.hamcrest'
        exclude group: 'org.objenesis'
    }
    compile('com.android.support.test.espresso:espresso-core:2.0') {
        exclude group: 'javax.inject'
        exclude group: 'org.hamcrest'
        exclude group: 'org.junit'
        exclude module: 'junit-dep'
    }
    compile('org.powermock:powermock:1.6.2') {
        exclude group: 'org.objenesis'
        exclude group: 'org.junit'
        exclude group: 'org.hamcrest'
    }
    compile('org.powermock:powermock-module-junit4:1.6.2') {
        exclude group: 'org.objenesis'
        exclude group: 'org.junit'
        exclude group: 'org.hamcrest'
        exclude module: 'powermock-core'
    }
    compile('cglib:cglib:2.2.2') {
        exclude group: 'org.objenesis'
        exclude group: 'org.junit'
        exclude group: 'org.hamcrest'
    }

    compile('org.powermock:powermock-api-mockito:1.5.5') {
        exclude group: 'org.objenesis'
        exclude group: 'org.junit'
        exclude group: 'org.hamcrest'
    }

我曾尝试将此类添加到gradle缓存中的另一个jar中,但我收到了类似“重复依赖”的错误。

0 个答案:

没有答案