Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange Build error in Azure Devops while using flutter

I used this guide https://medium.com/@levelfivecoder/how-to-build-sign-and-distribute-your-flutter-android-application-using-azure-devops-and-appcenter-965382b85b8b to make a build script on my azure devops server.

After a few successful builds I got the next error: ##[error]Error: The process '/Users/runner/hostedtoolcache/Flutter/1.20.1-stable/macos/flutter/bin/flutter' failed with exit code 1

Anyone encountered this error?

Update

I change the version as suggested to flutter 1.17.5 and now getting the next log error:

2020-08-18T07:40:48.2833420Z 
2020-08-18T07:40:53.9032320Z Running "flutter pub get" in angusclient...                         5.6s
2020-08-18T07:42:13.0082500Z Running Gradle task 'assembleRelease'...                        
2020-08-18T07:42:13.0102150Z 
2020-08-18T07:42:13.0103930Z Compiler message:
2020-08-18T07:42:13.0104400Z 
2020-08-18T07:42:13.0104760Z 
2020-08-18T07:42:13.0105700Z lib/ui/Alerts.dart:63:36: Error: Getter not found: 'arrow_upward_sharp'.
2020-08-18T07:42:13.0108430Z 
2020-08-18T07:42:13.0110350Z                   icon: Icon(Icons.arrow_upward_sharp),
2020-08-18T07:42:13.0113380Z 
2020-08-18T07:42:13.0115060Z                                    ^^^^^^^^^^^^^^^^^^
2020-08-18T07:42:13.0116500Z 
2020-08-18T07:42:13.0118540Z lib/ui/Alerts.dart:99:45: Error: Getter not found: 'warning_amber_outlined'.
2020-08-18T07:42:13.0120570Z 
2020-08-18T07:42:13.0121300Z                         leading: Icon(Icons.warning_amber_outlined),
2020-08-18T07:42:13.0122660Z 
2020-08-18T07:42:13.0124090Z                                             ^^^^^^^^^^^^^^^^^^^^^^
2020-08-18T07:42:19.7446230Z 
2020-08-18T07:42:19.7448540Z Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
2020-08-18T07:42:19.7448910Z 
2020-08-18T07:42:19.7450480Z build failed.
2020-08-18T07:42:19.8622130Z 
2020-08-18T07:42:19.8624860Z 
2020-08-18T07:42:19.8625260Z 
2020-08-18T07:42:19.8626630Z FAILURE: Build failed with an exception.
2020-08-18T07:42:19.8626970Z 
2020-08-18T07:42:19.8627080Z 
2020-08-18T07:42:19.8631600Z 
2020-08-18T07:42:19.8632370Z * Where:
2020-08-18T07:42:19.8632580Z 
2020-08-18T07:42:19.8633950Z Script '/Users/runner/hostedtoolcache/Flutter/1.17.5-stable/macos/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 882
2020-08-18T07:42:19.8640590Z 
2020-08-18T07:42:19.8644940Z 
2020-08-18T07:42:19.8645360Z 
2020-08-18T07:42:19.8645710Z 
2020-08-18T07:42:19.8646150Z * What went wrong:
2020-08-18T07:42:19.8647190Z Execution failed for task ':app:compileFlutterBuildRelease'.
2020-08-18T07:42:19.8647740Z 
2020-08-18T07:42:19.8648820Z > Process 'command '/Users/runner/hostedtoolcache/Flutter/1.17.5-stable/macos/flutter/bin/flutter'' finished with non-zero exit value 1
2020-08-18T07:42:19.8649590Z 
2020-08-18T07:42:19.8650010Z 
2020-08-18T07:42:19.8654130Z 
2020-08-18T07:42:19.8654380Z 
2020-08-18T07:42:19.8654850Z * Try:
2020-08-18T07:42:19.8656050Z Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
2020-08-18T07:42:19.8656480Z 
2020-08-18T07:42:19.8656630Z 
2020-08-18T07:42:19.8657370Z 
2020-08-18T07:42:19.8659660Z * Get more help at https://help.gradle.org
2020-08-18T07:42:19.8661880Z 
2020-08-18T07:42:19.8662150Z 
2020-08-18T07:42:19.8662590Z 
2020-08-18T07:42:19.8664140Z BUILD FAILED in 1m 24s
2020-08-18T07:42:20.6986960Z Running Gradle task 'assembleRelease'...                           86.4s
2020-08-18T07:42:20.7121710Z Gradle task assembleRelease failed with exit code 1
2020-08-18T07:42:20.7411260Z ##[error]Error: The process '/Users/runner/hostedtoolcache/Flutter/1.17.5-stable/macos/flutter/bin/flutter' failed with exit code 1
2020-08-18T07:42:20.7427470Z ##[section]Finishing: FlutterBuild

Thanks in advance to all the helpers :)

like image 775
Omri Shapira Avatar asked Aug 13 '20 08:08

Omri Shapira


3 Answers

##[error]Error: The process '/Users/runner/hostedtoolcache/Flutter/1.20.1-stable/macos/flutter/bin/flutter' failed with exit code 1

According to the error message, I tested flutter build task. When the Build number is invalid, I could get the same error.

enter image description here

It seems that this issue is related with Pipeline Build number. And the Build number need to be an integer value. BuildNumber -> $(Date:yyyyMMdd).$(Rev:r)

Workaround:

You could manually set the buildnumber value as an integer value in Yaml file(name:integer value).

For example:

name: $(BuildID)
variables:
  projectDirectory: 'xxx_tracker'
trigger:
- master
jobs:
  - job: Android
    pool:
      vmImage: 'macOS-latest'
    steps:
    - task: FlutterInstall@0
      inputs:
        channel: 'stable'
        version: 'latest'
    
    - task: FlutterBuild@0
      inputs:
        target: apk
        projectDirectory: $(projectDirectory)

You can also set specific integer values in name field.

Here is a github feedback ticket with the same issue. You can follow this post to check if there is progress.

Update:

In addition, you can use flutter version 1.17.5 . It can also work fine. In this case, you don't need to set buildnumber.

- task: FlutterInstall@0
  inputs:
    channel: 'stable'
    version: 'custom'
    customVersion: '1.17.5'
like image 85
Kevin Lu-MSFT Avatar answered Sep 28 '22 12:09

Kevin Lu-MSFT


In addition to using version 1.17.5, if you want to use the latest version of Flutter, which I recommended, there is another way to solve it.

ADD

name: $(Date:yyyyMMdd)$(Rev:r)

to the TOP of azure-pipelines.yml

like

name: $(Date:yyyyMMdd)$(Rev:r)
variables:
  projectDirectory: .
    
  jobs:
    - job: Android

Since $(Date:yyyyMMdd)$(Rev:.r) is used as $buildNumber, it is not available after version 1.17.5 (maybe flutter team fix it later). We can just simply change $(Rev:.r) to $(Rev:r). The build number be like 20200907.1 to 202009071

If you want to show prefix zeros in the number, you can add additional 'r' characters. For example, specify $(Rev:rr) if you want the Rev number to begin with 01, 02, and so on.

For more information about Configure run or build numbers, you can look this up.

like image 41
Sam Chan Avatar answered Sep 28 '22 10:09

Sam Chan


It take me few hour to figure this out but I found workaround how to use build number which you specify in pubspec.yaml (i.g. version: 1.0.1+11) for FlutterBuild.

Documentation for this task says it is optional, but some weird number is used, but if you specify build number like: buildNumber: '' (empty quotation marks). Then magic happen and your aplication will be build with build number specified in pubspec.yaml.

- task: FlutterBuild@0
  displayName: 'Flutter Build'
  inputs:
    target: 'aab'
    projectDirectory: '$(Build.SourcesDirectory)'
    buildNumber: ''
like image 44
LukasCodes Avatar answered Sep 28 '22 10:09

LukasCodes