Flutter Build Android Step - "panic: runtime error: index out of range"

Please describe the issue here

When building the Android project using Flutter Build step, I get failure: “panic: runtime error: index out of range”. It appears the the bundle has been built.

Where did the issue happen?

Flutter Build step, after it complete building Android bundle. I am not building iOS in this step.

Which build Step causes the issue and which version of the step?

Flutter Build v 0.12.0

E.g.: Git Clone v3.6.0

Reproducibility

  • Does a “Rebuild” help? (You can trigger a rebuild from the Build’s page, by clicking the “Rebuild” button in the top right corner of a finished build) : NO
  • Does a rebuild without caches help? (You can remove the Cache:Pull and Cache:Push steps temporarily to not to use the cache, or you can delete all the caches on the Settings tab of the app. : NO
  • Does the issue happen sporadically, or every time? : Every time
  • Does upgrading the build Step to the latest version help? : NO
  • When did the issue start? : From the start

Local reproduction

Can’t repro locally

Build log

Please copy paste the build’s bitrise.io URL here (or if the issue happens somewhere else then the full logs), or if you can’t share the url / log here then send the url or full log through a private channel (e.g. email - Contact us ), with a link to the related Discuss issue.

bitrise.yml


format_version: ‘8’
default_step_lib_source: GitHub - bitrise-io/bitrise-steplib: New Bitrise StepLib
project_type: flutter
trigger_map:

  • push_branch: “*”
    workflow: primary
  • pull_request_source_branch: “*”
    workflow: primary
    workflows:
    deploy:
    steps:
    • activate-ssh-key@4:
      run_if: ‘{{getenv “SSH_RSA_PRIVATE_KEY” | ne “”}}’
    • git-clone@4: {}
    • script@1:
      title: Do anything with Script step
    • certificate-and-profile-installer@1: {}
    • flutter-installer@0:
      inputs:
      • is_update: ‘false’
    • cache-pull@2: {}
    • flutter-analyze@0:
      inputs:
      • project_location: “$BITRISE_FLUTTER_PROJECT_LOCATION”
    • flutter-build@0:
      inputs:
      • project_location: “$BITRISE_FLUTTER_PROJECT_LOCATION”
      • platform: both
    • xcode-archive@2:
      inputs:
      • project_path: “$BITRISE_PROJECT_PATH”
      • scheme: “$BITRISE_SCHEME”
      • export_method: “$BITRISE_EXPORT_METHOD”
      • configuration: Release
    • deploy-to-bitrise-io@1: {}
    • cache-push@2: {}
      primary:
      steps:
    • activate-ssh-key@4:
      run_if: ‘{{getenv “SSH_RSA_PRIVATE_KEY” | ne “”}}’
    • git-clone@4: {}
    • script@1:
      title: Do anything with Script step
    • flutter-installer@0:
      inputs:
      • is_update: ‘false’
    • cache-pull@2: {}
    • flutter-analyze@0:
      inputs:
      • project_location: “$BITRISE_FLUTTER_PROJECT_LOCATION”
    • flutter-build@0.12:
      inputs:
      • android_output_type: appbundle
      • project_location: “$ANDROID_PROJECT_LOCATION”
      • android_output_pattern: build/app/outputs/bundle/release/app-release.aab
      • platform: android
    • deploy-to-bitrise-io@1: {}
    • cache-push@2: {}
    • google-play-deploy@3:
      inputs:
      • package_name: com.asure.mobile
      • app_path: “$ANDROID_BUILD_PATH”
      • service_account_json_key_path: “$googpleApiJson”
    • ios-auto-provision@1:
      inputs:
      • team_id:
      • distribution_type: app-store
    • flutter-build@0.12:
      inputs:
      • platform: android
      • android_output_type: appbundle
      • android_output_pattern: “*build/app/outputs/bundle/release/app-release.aab”
      • project_location: “$ANDROID_PROJECT_LOCATION”
        app:
        envs:
    • opts:
      is_expand: false
      BITRISE_FLUTTER_PROJECT_LOCATION: src
    • opts:
      is_expand: false
      BITRISE_PROJECT_PATH: src/ios/Runner.xcworkspace
    • opts:
      is_expand: false
      BITRISE_SCHEME: Runner
    • opts:
      is_expand: false
      BITRISE_EXPORT_METHOD: app-store
    • opts:
      is_expand: false
      ANDROID_BUILD_PATH: src/build/app/outputs/bundle/release/app-release.aab
    • opts:
      is_expand: false
      ANDROID_PROJECT_LOCATION: src/android

Build log:

±-----------------------------------------------------------------------------+

| (6) flutter-build@0.12 |
±-----------------------------------------------------------------------------+
| id: flutter-build |
| version: 0.12.0 |
| collection: GitHub - bitrise-io/bitrise-steplib: New Bitrise StepLib |
| toolkit: go |
| time: 2020-06-17T19:09:31Z |
±-----------------------------------------------------------------------------+
| |
Config:

  • IOSAdditionalParams: --release --no-codesign
  • AndroidAdditionalParams: --release
  • Platform: android
  • IOSExportPattern: build/ios/iphoneos/.app
  • AndroidOutputType: appbundle
  • AndroidExportPattern: build/app/outputs/bundle/release/app-release.aab
  • IOSCodesignIdentity:
  • ProjectLocation: src/android
  • DebugMode: false
  • AndroidBundleExportPattern: build/app/outputs/bundle//*.aab
    Build Android
    $ flutter “build” “appbundle” “–release”
    Changing current working directory to: /Users/vagrant/git/src
    Running Gradle task ‘bundleRelease’…
    Note: /usr/local/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.5.8+2/android/src/main/java/io/flutter/plugins/camera/CameraPlugin.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Removed unused resources: Binary resource data reduced from 557KB to 557KB: Removed 0%
    Running Gradle task ‘bundleRelease’… 219.3s (!)
    ✓ Built build/app/outputs/bundle/release/app-release.aab (19.3MB).
    Export Android artifact
    panic: runtime error: index out of range
    goroutine 1 [running]:
    main.buildSpecification.exportAndroidArtifacts(0x1320837, 0x7, 0xc0000163b4, 0x9, 0xc000092480, 0x2, 0x2, 0xc000088f30, 0x1, 0x1, …)
    /var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/bitrise-go-toolkit573646387/src/github.com/bitrise-steplib/bitrise-step-flutter-build/buildspec.go:105 +0x67d
    main.buildSpecification.exportArtifacts(0x1320837, 0x7, 0xc0000163b4, 0x9, 0xc000092480, 0x2, 0x2, 0xc000088f30, 0x1, 0x1, …)
    /var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/bitrise-go-toolkit573646387/src/github.com/bitrise-steplib/bitrise-step-flutter-build/buildspec.go:37 +0x21f
    main.main()
    /var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/bitrise-go-toolkit573646387/src/github.com/bitrise-steplib/bitrise-step-flutter-build/main.go:213 +0x104e
    | |
    ±–±--------------------------------------------------------------±---------+
    | x | flutter-build@0.12 (exit code: 2) | 3.8 min |
    ±–±--------------------------------------------------------------±---------+
    | Issue tracker: …thub.com/bitrise-steplib/bitrise-step-flutter-build/issues |
    | Source: GitHub - bitrise-steplib/bitrise-step-flutter-build |
    ±–±--------------------------------------------------------------±---------+

I enabled bitrise support

Hi @lgehrig44!

This is both an issue in the step (the output) and a configuration issue. We’re working on this task right now, but what you need to do to solve this is set the
*Output (.apk, .aab) pattern* input of the flutter-build step (under the : “Android Platform Config” category) to the following (replace app with host ):

*build/host/outputs/apk/*/*.apk
*build/host/outputs/bundle/*/*.aab

I tried changing the configuration to suggested values and still getting the same error. I’ll add that info to my open ticket.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.