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

cmdline-tools : could not determine SDK root #167

Closed
wtto00 opened this issue Sep 15, 2023 · 8 comments
Closed

cmdline-tools : could not determine SDK root #167

wtto00 opened this issue Sep 15, 2023 · 8 comments

Comments

@wtto00
Copy link
Contributor

wtto00 commented Sep 15, 2023

See this: https://9to5answer.com/cmdline-tools-could-not-determine-sdk-root

Please place cmdline-tools under the ANDROID_HOME directory, with the following directory structure: $ANDROID_HOME/cmdline-tools/latest/bin/avdmanager.

@amyu
Copy link
Owner

amyu commented Sep 17, 2023

👀

@amyu
Copy link
Owner

amyu commented Sep 17, 2023

Hi @wtto00 !
Thanks issue.

Under what conditions does this Issue occur?

@wtto00
Copy link
Contributor Author

wtto00 commented Sep 17, 2023

Hello, thank you for your reply.

I would like to start an emulator in CI. Please wait a moment while I write an example to reproduce it.

@wtto00
Copy link
Contributor Author

wtto00 commented Sep 17, 2023

When installing an SDK, I must add the parameter --sdk_root otherwise it will throw an error could not determine SDK root.

jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      - name: Setup JDK 17
        uses: actions/setup-java@v3
        with:
          java-version: 17
          distribution: temurin

      - name: Setup Android SDK
        uses: amyu/setup-android@v3

      # Runs a set of commands using the runners shell
      - name: Run a multi-line script
        run: |
          sdkmanager --install "system-images;android-31;default;x86_64"
          avdmanager -s create avd --name Android_Emulator --package "system-images;android-31;default;x86_64"
          $ANDROID_HOME/emulator/emulator -list-avds
          $ANDROID_HOME/emulator/emulator -verbose -avd Android_Emulator

When I added the --sdk-root parameter, the SDK installation was successful.

But how do I use the installed SDK?

When I use avdmanager -s create avd --name SomeName --package "system-images;android-31;default;x86_64", it shows an error Error: Package path is not valid. Valid system image paths are: null.

The demo: https://github.com/wtto00/demo-setup-android/actions/runs/6212159784

@amyu
Copy link
Owner

amyu commented Sep 17, 2023

Thanks for the demo!

I understand the problem.
The implementation did not work without --sdk-root parameter.

I have also found another problem and will fix it in V3

@amyu
Copy link
Owner

amyu commented Sep 17, 2023

@wtto00
#168
This Issue is probably fixed!

Use Actions from CommitHash if you want to use it quickly 🙏

@wtto00
Copy link
Contributor Author

wtto00 commented Sep 17, 2023

Wonderful! It works. https://github.com/wtto00/demo-setup-android/actions/runs/6213341498/job/16864301420

Thanks for your great work!

@wtto00 wtto00 closed this as completed Sep 17, 2023
@amyu
Copy link
Owner

amyu commented Sep 17, 2023

@wtto00
This fix has been included in v3
Thank you for reporting the Issue!

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

2 participants