5

我的 travis.yml 文件:

language: android

jdk: oraclejdk8

android:
  components:
    - build-tools-22.0.1
    - android-22
    - extra-android-m2repository

script:
    - gradle build connectedCheck

app:compileRetrolambdaDebug它在错误消息期间失败Process 'command '/usr/lib/jvm/java-8-oracle/bin/java'' finished with non-zero exit value 1

是否可以在 Travis CI 上运行 Retrolambda?

添加 --debug 参数后,我得到以下信息:

13:44:02.064 [INFO] [system.out] Error! Failed to transform some classes
13:44:02.073 [INFO] [system.out] java.lang.RuntimeException: java.lang.IllegalAccessException: no such method: cz.skaut.warehousemanager.fragment.ItemDetailFragment.lambda$onViewCreated$32(Bitmap)void/invokeSpecial
at net.orfjackal.retrolambda.lambdas.LambdaReifier.reifyLambdaClass(LambdaReifier.java:42)
at net.orfjackal.retrolambda.lambdas.BackportLambdaInvocations$InvokeDynamicInsnConverter.backportLambda(BackportLambdaInvocations.java:105)
at net.orfjackal.retrolambda.lambdas.BackportLambdaInvocations$InvokeDynamicInsnConverter.visitInvokeDynamicInsn(BackportLambdaInvocations.java:94)
at net.orfjackal.retrolambda.asm.ClassReader.readCode(ClassReader.java:1439)
at net.orfjackal.retrolambda.asm.ClassReader.readMethod(ClassReader.java:1017)
at net.orfjackal.retrolambda.asm.ClassReader.accept(ClassReader.java:693)
at net.orfjackal.retrolambda.asm.ClassReader.accept(ClassReader.java:506)
at net.orfjackal.retrolambda.Transformers.lambda$transform$4(Transformers.java:106)
at net.orfjackal.retrolambda.Transformers$$Lambda$2/1190900417.accept(Unknown Source)
at net.orfjackal.retrolambda.Transformers.transform(Transformers.java:120)
at net.orfjackal.retrolambda.Transformers.transform(Transformers.java:106)
at net.orfjackal.retrolambda.Transformers.backportClass(Transformers.java:46)
at net.orfjackal.retrolambda.Retrolambda.run(Retrolambda.java:72)
at net.orfjackal.retrolambda.Main.main(Main.java:26)
13:44:02.086 [INFO] [system.out] Caused by: java.lang.IllegalAccessException: no such method: cz.skaut.warehousemanager.fragment.ItemDetailFragment.lambda$onViewCreated$32(Bitmap)void/invokeSpecial
at java.lang.invoke.MemberName.makeAccessException(MemberName.java:872)
at java.lang.invoke.MemberName$Factory.resolveOrFail(MemberName.java:993)
at java.lang.invoke.MethodHandles$Lookup.resolveOrFail(MethodHandles.java:1379)
at java.lang.invoke.MethodHandles$Lookup.findSpecial(MethodHandles.java:997)
at net.orfjackal.retrolambda.lambdas.Types.toMethodHandle(Types.java:42)
at net.orfjackal.retrolambda.lambdas.Types.asmToJdkType(Types.java:19)
at net.orfjackal.retrolambda.lambdas.LambdaReifier.callBootstrapMethod(LambdaReifier.java:106)
at net.orfjackal.retrolambda.lambdas.LambdaReifier.reifyLambdaClass(LambdaReifier.java:37)
... 13 more
13:44:02.089 [INFO] [system.out] Caused by: java.lang.NoClassDefFoundError: android/support/v4/view/LayoutInflaterFactory
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at net.orfjackal.retrolambda.NonDelegatingClassLoader.loadClass(NonDelegatingClassLoader.java:25)
at java.lang.invoke.MethodHandleNatives.resolve(Native Method)
at java.lang.invoke.MemberName$Factory.resolve(MemberName.java:965)
at java.lang.invoke.MemberName$Factory.resolveOrFail(MemberName.java:990)
... 19 more
13:44:02.092 [INFO] [system.out] Caused by: java.lang.ClassNotFoundException: android.support.v4.view.LayoutInflaterFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at net.orfjackal.retrolambda.NonDelegatingClassLoader.loadClass(NonDelegatingClassLoader.java:27)
... 32 more

这里也报了类似的错误,可能是 Gradle-retrolambda 插件问题。

4

1 回答 1

14

在摆弄了几天之后,对我来说,它通过使用以下 .travis.yml 文件来工作:

language: android
jdk:
  - oraclejdk7
  - oraclejdk8
android:
  components:
    - build-tools-22.0.1
    - android-22
    - extra-android-support
    - extra-android-m2repository
  licenses:
    - '.+'

before_install:
  - export JAVA7_HOME=/usr/lib/jvm/java-7-oracle
  - export JAVA8_HOME=/usr/lib/jvm/java-8-oracle
  - export JAVA_HOME=$JAVA7_HOME
script:
  - ./gradlew clean assemble || ./gradlew clean assemble

最需要注意的是我们导出JAVA_HOMEJAVA7_HOME,我在任何在线示例中都没有看到。

于 2015-07-25T18:47:50.947 回答