Flutter build failing with licences not accepted error

#1

Description of the issue

Flutter build is failing with error -

Plugin project :location_web not found. Please update settings.gradle.

Checking the license for package Android SDK Build-Tools 28.0.3 in /opt/android-sdk-linux/licenses

Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.

Checking the license for package Android SDK Platform 28 in /opt/android-sdk-linux/licenses

Warning: License for package Android SDK Platform 28 not accepted.

My settings.gradle looks like this -

I have been stuck on this for a while now can anyone please help?

include ':app'

def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()

assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }

def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"

Environment:

Where did the issue happen?

If on Bitrise.io: which stack? If not on Bitrise.io: on what operating system? (Plus any other information you can share)

Flutter Build v0.13

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 the issue happen sporadically, or every time? : Everytime
  • Does upgrading the build Step to the latest version help? : NO

Build log

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

| (6) flutter-build@0.13 |
±-----------------------------------------------------------------------------+
| id: flutter-build |
| version: 0.13.2 |
| collection: https://github.com/bitrise-io/bitrise-steplib.git |
| toolkit: go |
| time: 2020-10-07T18:42:28Z |
±-----------------------------------------------------------------------------+
| |
Config:

  • IOSAdditionalParams: --release --no-codesign
  • AndroidAdditionalParams: --release --flavor staging -t lib/main_staging.dart
  • Platform: android
  • IOSExportPattern: build/ios/iphoneos/.app
  • AndroidOutputType: appbundle
  • AndroidExportPattern: build/app/outputs/apk//.apk
    build/app/outputs/bundle//
    .aab
  • IOSCodesignIdentity:
  • ProjectLocation: .
  • DebugMode: false
  • CacheLevel: all
  • AndroidBundleExportPattern: build/app/outputs/bundle//*.aab
    Build Android
    $ flutter “build” “appbundle” “–release” “–flavor” “staging” “-t” “lib/main_staging.dart”
    Downloading android-arm-profile/linux-x64 tools… 0.6s
    Downloading android-arm-release/linux-x64 tools… 0.2s
    Downloading android-arm64-profile/linux-x64 tools… 0.2s
    Downloading android-arm64-release/linux-x64 tools… 0.2s
    Downloading android-x64-profile/linux-x64 tools… 0.2s
    Downloading android-x64-release/linux-x64 tools… 0.1s
    Running Gradle task ‘bundleStagingRelease’…
    Plugin project :location_web not found. Please update settings.gradle.
    Checking the license for package Android SDK Build-Tools 28.0.3 in /opt/android-sdk-linux/licenses
    Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.
    Checking the license for package Android SDK Platform 28 in /opt/android-sdk-linux/licenses
    Warning: License for package Android SDK Platform 28 not accepted.
    FAILURE: Build failed with an exception.
  • What went wrong:
    Could not determine the dependencies of task ‘:flutter_sound_lite:compileReleaseJavaWithJavac’.

Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-28 Android SDK Platform 28
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: /opt/android-sdk-linux

  • Try:
    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.
  • Get more help at https://help.gradle.org
    BUILD FAILED in 2m 43s
    Running Gradle task ‘bundleStagingRelease’… 164.4s (!)
    Gradle task bundleStagingRelease failed with exit code 1
    Failed to build Android platform, error: exit status 1
    | |
    ±–±--------------------------------------------------------------±---------+
    | x | flutter-build@0.13 (exit code: 1) | 2.8 min |
    ±–±--------------------------------------------------------------±---------+
    | Issue tracker: …thub.com/bitrise-steplib/bitrise-step-flutter-build/issues |
    | Source: https://github.com/bitrise-steplib/bitrise-step-flutter-build |
    ±–±--------------------------------------------------------------±---------+
0 Likes

#2

Hi @shreyaspapi!

Can you try inserting a Script step before the failing step with the following contents?

yes |sdkmanager --install "build-tools;28.0.3"
0 Likes