user1134061
user1134061

Reputation: 55

aws pipeline buildspec android sdk not recognized

I am a new bee to AWS. I have created a build project with 'aws/codebuild/standard:5.0' docker image and also created a pipeline. While executing the pipeline, getting issues for android SDK not found.

[Container]  Running command ls $ANDROID_HOME/cmdline-tools
NOTICE.txt
bin
lib
source.properties

[Container] Running command echo "Checking Android SDK permissions"
Checking Android SDK permissions

[Container]  Running command chmod +x $ANDROID_HOME/cmdline-tools/bin/sdkmanager

[Container]  Running command flutter config --android-sdk $ANDROID_HOME
Setting "android-sdk" value to "/codebuild/output/src1636163750/src/android-sdk".

You may need to restart any open editors for them to read new settings.

[Container]  Running command sdkmanager --version
Error: Could not determine SDK root.
Error: Either specify it explicitly with --sdk_root= or move this package into its expected location: <sdk>/cmdline-tools/latest/ 

My buildspec.yml file looks like below

version: 0.2
run-as: root
phases:
  install:
    runtime-versions:
      java: corretto11
    commands:
      - echo $PWD
  pre_build:
    commands:
      - echo Installing flutter dependencies
      - export FLUTTER_SDK=$CODEBUILD_SRC_DIR/flutter-sdk
      - mkdir $FLUTTER_SDK
      - git clone https://github.com/flutter/flutter.git $FLUTTER_SDK -b stable
      - export PATH="$PATH:$FLUTTER_SDK/bin"
      - flutter precache 
      - echo "Installing Android SDK"
      - export android_sdk=$CODEBUILD_SRC_DIR/android-sdk
      - mkdir -p $android_sdk
      - wget https://dl.google.com/android/repository/commandlinetools-linux-9123335_latest.zip -O android-sdk.zip
      - unzip -q android-sdk.zip -d $android_sdk
      - export ANDROID_HOME=$CODEBUILD_SRC_DIR/android-sdk
      - export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/cmdline-tools/bin
      - echo "Checking Android SDK permissions"
      - chmod +x $ANDROID_HOME/cmdline-tools/bin/sdkmanager
      - flutter config --android-sdk $ANDROID_HOME
      - sdkmanager --version  # Check if sdkmanager is now found
      - yes | sdkmanager --licenses  # Accept Android SDK licenses

What's wrong here? Please guide

Upvotes: 0

Views: 124

Answers (0)

Related Questions