Missing ANDROID_SDK_ROOT when runner run without sudo
I try to build my flutter project using flutter-runner (run in shell)
If I us sudo gitlab-runner run
then Android build works but iOS build fails with error message:
error: No profile for team ‘7######F’ matching ‘B####AdHoc’ found: Xcode couldn’t find any provisioning profiles matching ‘7######F/B####AdHoc’. Install the profile (by dragging and dropping it onto Xcode’s dock item) or select a different one in the Signing & Capabilities tab of the target editor. (in target ‘Runner’ from project ‘Runner’)
and also gitlab-runner warn me, that I shouldn’t run it with sudo.
On the other hand, when I run gitlab-runner without sudo then iOS build is working without any errors, but Android build fails with message:
“No Android SDK found. Try setting the ANDROID_SDK_ROOT environment variable.” I added this variable but it didn’t help.
How to solve this problem with Android builds?