Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter builder fails with Android sdkmanager not found and android-licenses errors #526

Open
ozc opened this issue Aug 20, 2021 · 3 comments

Comments

@ozc
Copy link

ozc commented Aug 20, 2021

Affected builder image

gcr.io/cloud-builders-community/flutter

Trying to build Flutter image and getting the error below

gcloud builds submit --config cloudbuild.yaml .

Step #0:   ╔════════════════════════════════════════════════════════════════════════════╗
Step #0:   ║                 Welcome to Flutter! - https://flutter.dev                  ║
Step #0:   ║                                                                            ║
Step #0:   ║ The Flutter tool uses Google Analytics to anonymously report feature usage ║
Step #0:   ║ statistics and basic crash reports. This data is used to help improve      ║
Step #0:   ║ Flutter tools over time.                                                   ║
Step #0:   ║                                                                            ║
Step #0:   ║ Flutter tool analytics are not sent on the very first run. To disable      ║
Step #0:   ║ reporting, type 'flutter config --no-analytics'. To display the current    ║
Step #0:   ║ setting, type 'flutter config'. If you opt out of analytics, an opt-out    ║
Step #0:   ║ event will be sent, and then no further information will be sent by the    ║
Step #0:   ║ Flutter tool.                                                              ║
Step #0:   ║                                                                            ║
Step #0:   ║ By downloading the Flutter SDK, you agree to the Google Terms of Service.  ║
Step #0:   ║ Note: The Google Privacy Policy describes how data is handled in this      ║
Step #0:   ║ service.                                                                   ║
Step #0:   ║                                                                            ║
Step #0:   ║ Moreover, Flutter includes the Dart SDK, which may send usage metrics and  ║
Step #0:   ║ crash reports to Google.                                                   ║
Step #0:   ║                                                                            ║
Step #0:   ║ Read about data we send with crash reports:                                ║
Step #0:   ║ https://flutter.dev/docs/reference/crash-reporting                         ║
Step #0:   ║                                                                            ║
Step #0:   ║ See Google's privacy policy:                                               ║
Step #0:   ║ https://policies.google.com/privacy                                        ║
Step #0:   ╚════════════════════════════════════════════════════════════════════════════╝
Step #0: 
Step #0: Analytics reporting disabled.
Step #0: 
Step #0: You may need to restart any open editors for them to read new settings.
Step #0: Removing intermediate container d338229261c9
Step #0:  ---> 8f8922af3ab7
Step #0: Step 22/28 : RUN flutter precache
Step #0:  ---> Running in f20224728023
Step #0: Downloading Material fonts...                                      691ms
Step #0: Downloading Gradle Wrapper...                                       52ms
Step #0: Downloading android-arm-profile/linux-x64 tools...                 611ms
Step #0: Downloading android-arm-release/linux-x64 tools...                 459ms
Step #0: Downloading android-arm64-profile/linux-x64 tools...               480ms
Step #0: Downloading android-arm64-release/linux-x64 tools...               427ms
Step #0: Downloading android-x64-profile/linux-x64 tools...                 365ms
Step #0: Downloading android-x64-release/linux-x64 tools...                 304ms
Step #0: Downloading android-x86 tools...                                 2,966ms
Step #0: Downloading android-x64 tools...                                 2,732ms
Step #0: Downloading android-arm tools...                                 1,488ms
Step #0: Downloading android-arm-profile tools...                           530ms
Step #0: Downloading android-arm-release tools...                           523ms
Step #0: Downloading android-arm64 tools...                               1,496ms
Step #0: Downloading android-arm64-profile tools...                         755ms
Step #0: Downloading android-arm64-release tools...                         542ms
Step #0: Downloading android-x64-profile tools...                           553ms
Step #0: Downloading android-x64-release tools...                           690ms
Step #0: Downloading android-x86-jit-release tools...                       714ms
Step #0: Downloading Web SDK...                                              4.4s
Step #0: Downloading package sky_engine...                                  153ms
Step #0: Downloading flutter_patched_sdk tools...                           255ms
Step #0: Downloading flutter_patched_sdk_product tools...                   265ms
Step #0: Downloading linux-x64 tools...                                   2,943ms
Step #0: Downloading linux-x64/font-subset tools...                         231ms
Step #0: Removing intermediate container f20224728023
Step #0:  ---> 6796464e1084
Step #0: Step 23/28 : RUN yes "y" | flutter doctor --android-licenses
Step #0:  ---> Running in 7d0bed25e23a
Step #0: Android sdkmanager not found. Update to the latest Android SDK and ensure that the cmdline-tools are installed to resolve this.
Step #0: The command '/bin/sh -c yes "y" | flutter doctor --android-licenses' returned a non-zero code: 1
Finished Step #0
ERROR
ERROR: build step 0 "docker:stable" failed: step exited with non-zero status: 1
Step #0: 
--------------------------------------------------------------------------------------------------------------------------------------------------------------
ERROR: (gcloud.builds.submit) build b3291ea8-f7f1-468a-8463-cda2c8d2391c completed with status "FAILURE"

@markkimsal
Copy link

Maybe try this

diff --git a/flutter/Dockerfile b/flutter/Dockerfile
index 431d906..13946a8 100644
--- a/flutter/Dockerfile
+++ b/flutter/Dockerfile
@@ -28,9 +28,10 @@ RUN mkdir -p "${ANDROID_TOOLS_ROOT}"
 ENV ANDROID_SDK_ARCHIVE="${ANDROID_TOOLS_ROOT}/archive"
 RUN wget -q "${ANDROID_SDK_URL}" -O "${ANDROID_SDK_ARCHIVE}"
 RUN unzip -q -d "${ANDROID_TOOLS_ROOT}" "${ANDROID_SDK_ARCHIVE}"
-RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "build-tools;28.0.0"
-RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "platforms;android-28"
+RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "build-tools;29.0.0"
+RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "platforms;android-29"
 RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "platform-tools"
+RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "--install" "cmdline-tools;latest"

@luckyluke5
Copy link

luckyluke5 commented Oct 12, 2021

Can you explain your solution, how can use it to fix the error?

@luckyluke5
Copy link

https://github.com/Sugihiru/cloud-builders-community solved it for me.

#518 should be accepted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants