actions / runner-images

GitHub Actions runner images
MIT License
10.22k stars 3.07k forks source link

Android SDK Build Tools doesn't exists on macOS runners on default #10814

Open mcagabe19 opened 1 month ago

mcagabe19 commented 1 month ago

Description

title and I use ANDROID_HOME env btw

(sorry if something is wrong, I'm first time making issue to here)

Platforms affected

Runner images affected

Image version and build link

Version: 20241014.193 Link to build: https://github.com/MobilePorting/FPS-Plus-Mobile/actions/runs/11408800443/job/31747750013

Is it regression?

uhhh no ig?

Expected behavior

To Build

Actual behavior

build-tools is missing or misplaced, idk really

Repro steps

  1. Set sdk path to lime
  2. Run a build
  3. Getting build-tools missing
mcagabe19 commented 1 month ago

after some digging and using find on $ANDROID_HOME, I can confirm it's really not there and don't get confused with tools folder, it's not really build-tools

sarathrajsrinivasan commented 1 month ago

Hi @mcagabe19 ,

We are looking into it. Will keep you posted.

sarathrajsrinivasan commented 1 month ago

Hi @mcagabe19 ,

We are able to see the Android SDK Build tools in all macOS12, macOS13 and macOS14 images.

We are investigating for macOS15. In the meantime please check your workflow with either macOS13 or macOS14.

    steps: 
    - name: Check Android SDK Build tools
      run: |
        echo "ANDROID_HOME is set to: $ANDROID_HOME"
        echo "Contents of Users/runner/Library/Android/sdk/build-tools/"
        ls -ltr /Users/runner/Library/Android/sdk/build-tools/
mcagabe19 commented 1 month ago

on a test workflow, indeed macOS 12, 13 and 14 does have https://github.com/mcagabe19/v/actions/runs/11476806865

so that means only macOS 15 doesn't have

qwertylolman commented 3 weeks ago

finally, I found this ticket xD

any workarounds? it's critical for us, and PR is still not approved

mcagabe19 commented 3 weeks ago

finally, I found this ticket xD

any workarounds? it's critical for us, and PR is still not approved

https://github.com/MobilePorting/FNF-PsychEngine-Mobile/blob/6d805893ffdb391be5dbaa1f3dae717463d258a4/.github/workflows/build.yml#L43-L51

sven-s commented 2 weeks ago

The build-tools are not on macos-15. I need it for my maui project, since i got this error:

/Users/runner/hostedtoolcache/dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.143/targets/Microsoft.Android.Sdk.Tooling.targets(31,5): error XA5205: Cannot find aapt. Please install the Android SDK Build-Tools package with the /Users/runner/Library/Android/sdk/tools/android program. [/Users/runner/work/1/s/cpm-app/cpm-app.csproj::TargetFramework=net8.0-android]

Please make the build-tools available. Thanks!

visualspark commented 1 week ago

The build-tools are not on macos-15. I need it for my maui project, since i got this error:

/Users/runner/hostedtoolcache/dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.143/targets/Microsoft.Android.Sdk.Tooling.targets(31,5): error XA5205: Cannot find aapt. Please install the Android SDK Build-Tools package with the /Users/runner/Library/Android/sdk/tools/android program. [/Users/runner/work/1/s/cpm-app/cpm-app.csproj::TargetFramework=net8.0-android]

Please make the buidl-tools available. Thanks!

Same with me, since upgrading to macos-15 to compile my maui ios project with xcode 16, my android tasks are failing.

All projects are up-to-date for restore.
/Users/runner/hostedtoolcache/dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.145/targets/Microsoft.Android.Sdk.Tooling.targets(31,5): error XA5205: Cannot find `aapt`. Please install the Android SDK Build-Tools package with the `/Users/runner/Library/Android/sdk/tools/android` program. [/Users/runner/work/1/s/App/App.csproj::TargetFramework=net8.0-android]
mcagabe19 commented 1 week ago

finally, I found this ticket xD any workarounds? it's critical for us, and PR is still not approved

https://github.com/MobilePorting/FNF-PsychEngine-Mobile/blob/6d805893ffdb391be5dbaa1f3dae717463d258a4/.github/workflows/build.yml#L43-L51

I guess this workaround still gonna apply for a while

d-philipson commented 1 week ago

After a breakage in the MAUI workloads a few weeks ago everyone was advised to migrate to macOS-14 and Xcode 16. Now the rug has been pulled by removing Xcode 16 from macOS-14 and breaking lots of peoples build pipelines in the process. Any word on when the Android build tools will be added to macOS-15?

mcagabe19 commented 1 week ago

whenever this pull request is merged, it'll be fixed I think https://github.com/actions/runner-images/pull/10912

spelletier commented 1 week ago

I managed to get my Azure Devon pipelines to complete by adding a script task after the MAUI install. Replace $(AndroidProjectPath) with your own path to the Android project.

    - script: |
          dotnet workload install maui
      displayName: 'Install MAUI workload'

    - script: |
          yes | /Users/runner/Library/Android/sdk/tools/bin/sdkmanager --licenses
          dotnet build -t:InstallAndroidDependencies -f net8.0-android "-p:AndroidSdkDirectory=/Users/runner/Library/Android/sdk"
      workingDirectory: $(AndroidProjectPath)
      displayName: 'Install Android sdk dependencies'
TomSoPolaris commented 1 week ago

I was able to work around this but had to add these 3 tasks after the step to install the MAUI workloads. We're building our .NET MAUI app with Android 14 as the target version (API level 34).

# Workaround for Android build tools not being available on macos-15 agents: https://github.com/actions/runner-images/issues/10814
- task: Bash@3
  displayName: 'Workaround build-tools issue'
  inputs:
    targetType: 'inline'
    script: |
      curl https://dl.google.com/android/repository/build-tools_r35_macosx.zip > $ANDROID_HOME/build-tools_r35_macosx.zip
      cd $ANDROID_HOME
      mkdir build-tools
      unzip build-tools_r35_macosx.zip
      mv android-15 build-tools/35.0.0

# Workaround. Need to install sdkmanager first. sdkmanager is required for installing the Android SDK platform
- task: Bash@3
  displayName: 'Install Android SDK Command-line Tools'
  inputs:
    targetType: 'inline'
    script: |
      echo "Installing Android SDK Command-line Tools..."
      mkdir -p $ANDROID_HOME/cmdline-tools
      curl -o commandlinetools.zip https://dl.google.com/android/repository/commandlinetools-mac-7583922_latest.zip
      unzip commandlinetools.zip -d $ANDROID_HOME/cmdline-tools
      mv $ANDROID_HOME/cmdline-tools/cmdline-tools $ANDROID_HOME/cmdline-tools/latest
      export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin
      yes | sdkmanager --licenses
      yes | sdkmanager "platforms;android-34"

# Workaround for macos-15 error: Could not find android.jar for API level 34. This means the Android SDK platform for API level 34 is not installed
- task: Bash@3
  displayName: 'Install Android SDK for API level 34'
  inputs:
    targetType: 'inline'
    script: |
      echo "Setting up Android SDK environment variables..."
      export ANDROID_HOME=$HOME/Library/Android/sdk
      export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools

      echo "Installing Android SDK components..."
      yes | sdkmanager "platforms;android-34"
mcagabe19 commented 2 days ago

now build-tools does exists but there's nothing on it