# Accept licenses of Android sdkmanager via pipe

**URL:** <https://forums.powershell.org/t/accept-licenses-of-android-sdkmanager-via-pipe/21005>\
**Category:** PowerShell Help\
**Created:** [November 25, 2022, 9:08am UTC](https://forums.powershell.org/t/accept-licenses-of-android-sdkmanager-via-pipe/21005 "2022-11-25T09:08:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kalgik](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/kalgik/32/4112_2.png) [@kalgik](https://forums.powershell.org/u/kalgik)\
**Post date:** [November 25, 2022, 9:08am UTC](https://forums.powershell.org/t/accept-licenses-of-android-sdkmanager-via-pipe/21005/1 "2022-11-25T09:08:04Z")

</div>

Hello everyone.

I would like to install the Android SDK Command-Line tools from the powershell. I could not find any way to pass “yes” to accept automatically the licenses for Android SDK command line tools. Here is:

```auto
echo yes | sdkmanager --sdk_root=${ANDROID_HOME} --licenses

```

By that, I am always prompted to type “y” or “n” in the powershell. Is it possible to pass the “yes” or “y” via the pipe?  
Do you have any idea?

I also tested the following withou any success:

```auto
echo "yes" | sdkmanager --sdk_root=${ANDROID_HOME} --licenses
echo "y" | sdkmanager --sdk_root=${ANDROID_HOME} --licenses
echo y | sdkmanager --sdk_root=${ANDROID_HOME} --licenses

```

Regards,

---

<div class="post-metadata">

**Author:** ![krzydoug](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/krzydoug/32/1008_2.png) [@krzydoug](https://forums.powershell.org/u/krzydoug)\
**Post date:** [November 25, 2022, 10:44pm UTC](https://forums.powershell.org/t/accept-licenses-of-android-sdkmanager-via-pipe/21005/2 "2022-11-25T22:44:02Z")

</div>

Have you tried removing `echo`?

```auto
“y” | command

```

---

<div class="post-metadata">

**Author:** ![kalgik](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/kalgik/32/4112_2.png) [@kalgik](https://forums.powershell.org/u/kalgik)\
**Post date:** [November 26, 2022, 12:53pm UTC](https://forums.powershell.org/t/accept-licenses-of-android-sdkmanager-via-pipe/21005/3 "2022-11-26T12:53:59Z")

</div>

I have also tried the followings

```auto
"y" | command
'y' | command
'Y' | command
"yes" | command
'yes' | command
'Yes' | command
'YES' | command

```

without any success.

---

<div class="post-metadata">

**Author:** ![krzydoug](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/krzydoug/32/1008_2.png) [@krzydoug](https://forums.powershell.org/u/krzydoug)\
**Post date:** [November 27, 2022, 12:34am UTC](https://forums.powershell.org/t/accept-licenses-of-android-sdkmanager-via-pipe/21005/4 "2022-11-27T00:34:55Z")

</div>

There is more than one license. Try this

```auto
(1..10 | ForEach-Object {"Yes"; Start-Sleep -Milliseconds 100}) | sdkmanager --sdk_root=${ANDROID_HOME} --licenses

```

---

<div class="post-metadata">

**Author:** ![kalgik](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/kalgik/32/4112_2.png) [@kalgik](https://forums.powershell.org/u/kalgik)\
**Post date:** [November 29, 2022, 8:23am UTC](https://forums.powershell.org/t/accept-licenses-of-android-sdkmanager-via-pipe/21005/5 "2022-11-29T08:23:53Z")

</div>

Thank you. It works properly in the PowerShell of my Windows machine! However, if I run this command in the GitLab runner for Windows, it is not executed as it is expected. I still receive:

```auto
7 of 7 SDK package licenses not accepted.
Review licenses that have not been accepted (y/N)? 

```

My Windows’ PowerShell version is 5.1.19041.1682 and GitLab’s runner version is 5.1.17763.1007 (execute $host command).

I tried to delay the execution of the command playing with [Start-Sleep arguments](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/start-sleep?view=powershell-7.3) ([-Seconds], increase value for -Milliseconds and for -Duration), but without any success.

I really appreciate any ideas.

Regards

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:16pm UTC](https://forums.powershell.org/t/accept-licenses-of-android-sdkmanager-via-pipe/21005/6 "2024-05-16T20:16:16Z")

</div>

Closed on May 16, 2024, 8:16pm UTC


