CircleN上的ReactNative 0.59.x构建失败,退出值为137

时间:2019-05-06 10:03:20

标签: android react-native circleci

在CircleCI上为v0.59.x构建应用程序时,出现以下错误(以前一直可以正常工作到v0.57.8):

[12:45:19]: ▸ Note: Some input files use or override a deprecated API.
[12:45:19]: ▸ Note: Recompile with -Xlint:deprecation for details.
[12:45:19]: ▸ > Task :react-native-svg:processReleaseJavaRes NO-SOURCE
[12:45:19]: ▸ > Task :react-native-svg:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease
[12:45:19]: ▸ > Task :app:javaPreCompileQa
[12:45:44]: ▸ > Task :app:bundleQaJsAndAssets
[12:45:44]: ▸ warning: the transform cache was reset.
[12:46:00]: ▸ Loading dependency graph, done.
[12:46:19]: ▸ > Task :app:bundleQaJsAndAssets FAILED
[12:46:19]: ▸ FAILURE: Build failed with an exception.
[12:46:19]: ▸ * What went wrong:
[12:46:19]: ▸ Execution failed for task ':app:bundleQaJsAndAssets'.
[12:46:19]: ▸ > Process 'command 'node'' finished with non-zero exit value 137

我认为这与内存或Gradle / Java选项有关,因为该构建在我的本地计算机(./gradlew assembleRelease)上运行正常

圈子配置中的有用代码段:

jobs:
  make-android:
    ...
    docker:
      - image: circleci/android:api-28-node8-alpha
    environment:
      TERM: dumb
      # JAVA_OPTS...
      # GRADLE_OPTS...
    steps:
      - checkout:
          path: *root_dir
      - attach_workspace:
          at: *root_dir
      - run:
          name: Build the app
          no_output_timeout: 30m
          command: bundle exec fastlane make

fastlane make

gradle(task: "clean")
gradle(task: "assembleRelease")

我尝试了多个JAVA_OPTS和GRADE_OPTS,包括将它们删除(过去在v0.57.8的情况下,如果没有_OPTS,它都可以正常工作)

JAVA_OPTS: "-Xms512m -Xmx4096m"
GRADLE_OPTS: -Xmx4096m -Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-Xms512m -Xmx4096m -XX:+HeapDumpOnOutOfMemoryError"
JAVA_OPTS: "-Xms512m -Xmx2048m"
GRADLE_OPTS: -Xmx2048m -Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"

我在android / app / build.gradle中也有这个

dexOptions {
    javaMaxHeapSize "2g"
    preDexLibraries false
}

1 个答案:

答案 0 :(得分:1)

原因之一可能是地铁打包机正在使用的工人数量。

maxWorkers: <# workers>中设置metro.config.js已为我修复。

module.exports = {
    transformer: {
    getTransformOptions: async () => ({
        transform: {
        experimentalImportSupport: false,
        inlineRequires: false,
        },
    }),
    },
    maxWorkers: 2,
};

我更改的其他内容在JAVA_OPTS中设置了GRADLE_OPTS.circle/config.yml

JAVA_OPTS: '-Xms512m -Xmx2g'
GRADLE_OPTS: '-Xmx3g -Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-Xmx2g -XX:+HeapDumpOnOutOfMemoryError"'