简体   繁体   English

在测试版本脚本中找不到Actionbar Sherlock

[英]Actionbar Sherlock Not Found in Test Build Script

I have 2 gradle.build scripts, one for my app and one for my test. 我有2个gradle.build脚本,一个用于我的应用程序,一个用于我的测试。 The app has a dependency on actionbarsherlock as follows: 该应用程序对actionbarsherlock的依赖关系如下:

dependencies {

    compile project(':shared-jars')

    compile ('com.actionbarsherlock:actionbarsherlock:4.4.0@aar') {
        exclude module: 'support-v4'
    }
}

and assembleRelease works correctly. assembleRelease正常工作。

However when doing a build, the test build doesn't compile because it can't find actionbarsherlock. 但是,在进行构建时,测试构建不会编译,因为它找不到actionbarsherlock。 For example: 例如:

14:27:52.847 [INFO] [org.gradle.api.internal.tasks.compile.jdk6.Jdk6JavaCompiler] Compiling with JDK Java compiler API.
14:27:54.240 [ERROR] [system.err] /Users/bradrhoads/Documents/src/estante/src/android/src/main/java/org/maf/estante/Discover.java:13: package com.actionbarsherlock.app does not exist

I've tried adding the same compile dependency in the test build as well as trying to depend on the app's transitive dependencies. 我尝试在测试版本中添加相同的编译依赖项,并尝试依赖应用程序的传递依赖项。 But in eather case I get the not found error. 但是在所有情况下,我都会得到未发现的错误。 Here's the entire test build script: 这是整个测试构建脚本:

def props = new Properties()
file("../local.properties").withInputStream {
    stream -> props.load(stream)
}

repositories {
    mavenCentral()
    maven {
        url new File(props['sdk.dir'] + "/extras/android/m2repository/").toURI()
    }
}

apply plugin: 'groovy'


dependencies {
    compile "org.codehaus.groovy:groovy-all:1.8.6"
    compile 'org.robospock:robospock:0.4.4'

    compile 'cglib:cglib-nodep:3.1'

    compile 'com.jakewharton:butterknife:4.0.1'


    //compile fileTree(dir: ':android:libs', include: '*.jar')
    compile project(":shared-jars")

    compile ('com.actionbarsherlock:actionbarsherlock:4.4.0@aar') {
        exclude module: 'support-v4'
    }

    compile (project(":estanteApp")) {
        transitive = true
    }


}

sourceSets.test.java.srcDirs = ['../android/src/main/java', '../android/build/source/r/debug']

test {

    systemProperty 'ro.build.date.utc', '1'
    systemProperty 'ro.kernel.qemu', '0'

    beforeTest { descriptor ->
        logger.lifecycle("Running test: " + descriptor)
    }

    testLogging {
        lifecycle {
            exceptionFormat "full"
        }
    }

    workingDir = '../android/src/main'

}


tasks["test"].dependsOn project(":estanteApp").tasks["compileDebugJava"]

Groovy plugin doesn't understand the aar dependency. Groovy插件不了解aar依赖关系。 Currently only android* plugins can evaluate such dependencies. 目前,只有android *插件可以评估此​​类依赖关系。

You could try first to assemble the Android project and link to build/exploded-aar/com.actionbarsherlock/actionbarsherlock/4.4.0/classes.jar but I'm not sure how robolectric will act with resources from aar lib. 您可以先尝试组装Android项目并链接到build / exploded-aar / com.actionbarsherlock / actionbarsherlock / 4.4.0 / classes.jar,但我不确定robolectric如何处理来自aar lib的资源。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM