title: Azure DevOps pipeline android build setting sdk location
body: <p>I am trying to build an android app using a yaml pipeline. The gradle build task is complaining that it can't find the android sdk root. I've tried both the local.properties file and the environmental variable ANDROID_SDK_ROOT, and neither work. This is my build pipeline:</p>
  <pre><code># Android
  # Build your Android project with Gradle.
  # Add steps that test, sign, and distribute the APK, save build artifacts, and more:
  # https://docs.microsoft.com/azure/devops/pipelines/languages/android
  
  trigger:
  - master
  - dev
  
  pool:
   name: 'Default'
  
  steps:
  
  - task: UseDotNet@2
    inputs:
      version: '2.2.x'
      packageType: runtime
      
  - task: GitVersion@5
    displayName: GitVersion
    inputs:
      useConfigFile: true
      configFilePath: GitVersion.yml
  
  # trying to set the env variable doesn't work.
  # - task: PowerShell@2 
  #   inputs:
  #     targetType: 'inline'
  #     script: |
  #       # Write your PowerShell commands here.
        
  #       [Environment]::SetEnvironmentVariable(&quot;ANDROID_SDK_ROOT&quot;, &quot;C:\Users\Administrator\AppData\Local\Android\Sdk&quot;, &quot;User&quot;)
  
  - task: file-creator@6
    inputs:
      filepath: '$(System.DefaultWorkingDirectory)/local.properties'
      filecontent: 'sdk.dir=C:/Users/Administrator/AppData/Local/Android/Sdk'
      fileoverwrite: true
  
  # trying to execute gradlew manually does not work
  # - task: CmdLine@2
  #   inputs:
  #     script: |
  #       gradlew.bat assembleDebug
  #     workingDirectory: '$(System.DefaultWorkingDirectory)'
  
  - task: Gradle@2
    inputs:
      workingDirectory: '$(System.DefaultWorkingDirectory)'
      gradleWrapperFile: 'gradlew'
      gradleOptions: '-Xmx3072m'
      publishJUnitResults: false
      testResultsFiles: '**/TEST-*.xml'
      tasks: 'assembleDebug'
  </code></pre>
  <p>This is the output:</p>
  <pre><code>Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/gradle
  ==============================================================================
  SYSTEMVSSCONNECTION exists true
  C:\Windows\system32\cmd.exe /D /S /C &quot;C:\VSTS\_work\8\s\gradlew.bat -p C:\VSTS\_work\8\s assembleDebug&quot;
  Starting a Gradle Daemon, 1 incompatible and 4 stopped Daemons could not be reused, use --status for details
  
  &gt; Configure project :app
  registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
  registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
  registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
  &gt; SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at 'C:\VSTS\_work\8\s\local.properties'.
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  
  * Get more help at https://help.gradle.org
  
  BUILD FAILED in 16s
  Error: The process 'C:\VSTS\_work\8\s\gradlew.bat' failed with exit code 1
      at ExecState._setResult (C:\VSTS\_work\_tasks\Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4\2.176.0\node_modules\azure-pipelines-task-lib\toolrunner.js:816:25)
      at ExecState.CheckComplete (C:\VSTS\_work\_tasks\Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4\2.176.0\node_modules\azure-pipelines-task-lib\toolrunner.js:799:18)
      at ChildProcess.&lt;anonymous&gt; (C:\VSTS\_work\_tasks\Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4\2.176.0\node_modules\azure-pipelines-task-lib\toolrunner.js:721:19)
      at emitTwo (events.js:106:13)
      at ChildProcess.emit (events.js:191:7)
      at maybeClose (internal/child_process.js:920:16)
      at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
  ##[error]Error: The process 'C:\VSTS\_work\8\s\gradlew.bat' failed with exit code 1
  Finishing: Gradle
  </code></pre>
  <p>If I rdp into the build agent and run gradlew manually with the generated local.properties file present from the command line the build DOES succeed though, so I'm not sure what the issue with running it in a pipeline is.</p>