title: gradle build of android project using hidden apis: fails in some build environments and succeeds in others
body: <p>I have an android project that uses some hidden API (e plan to fix this in future but not now).</p>
  
  <p>The same master branch of the project's git repo builds fine is some build environments but gives compile errors in some build environment on the lines of code that use the hidden api.</p>
  
  <p>The command I use in both environment is: <code>./gradlew clean assembleRelease</code></p>
  
  <p>In one environment it builds fine. In another environment it gives compile errors like:</p>
  
  <pre><code>&gt; Task :myproject:compileReleaseJavaWithJavac FAILED
  /home/farrukh/myproject/src/main/java/com/mycompany/myproject/MyClass.java:4: error: cannot find symbol
  import android.os.SystemProperties;
                   ^
    symbol:   class SystemProperties
    location: package android.os
  /home/farrukh/myproject/src/main/java/com/mycompany/myproject/MyClass.java:82: error: cannot find symbol
              partNumber = SystemProperties.get("ro.boot.partnumber", null);
                           ^
    symbol:   variable SystemProperties
    location: class MyClass
  Note: Some input files use or override a deprecated API.
  Note: Recompile with -Xlint:deprecation for details.
  2 errors
  </code></pre>
  
  <p>In both cases the Android SDK has Android 9.0 (API 28) installed but the specific sub-version could be different.</p>
  
  <p>In the environment where the build fails the following info is generated from <code>sdkmanager --list</code>:</p>
  
  <pre><code>Path                 | Version | Description                    | Location             
    -------              | ------- | -------                        | -------              
    build-tools;28.0.3   | 28.0.3  | Android SDK Build-Tools 28.0.3 | build-tools/28.0.3/  
    build-tools;29.0.2   | 29.0.2  | Android SDK Build-Tools 29.0.2 | build-tools/29.0.2/  
    emulator             | 30.0.0  | Android Emulator               | emulator/            
    patcher;v4           | 1       | SDK Patch Applier v4           | patcher/v4/          
    platform-tools       | 29.0.6  | Android SDK Platform-Tools     | platform-tools/      
    platforms;android-18 | 3       | Android SDK Platform 18        | platforms/android-18/
    platforms;android-23 | 3       | Android SDK Platform 23        | platforms/android-23/
    platforms;android-24 | 2       | Android SDK Platform 24        | platforms/android-24/
    platforms;android-26 | 2       | Android SDK Platform 26        | platforms/android-26/
    platforms;android-27 | 3       | Android SDK Platform 27        | platforms/android-27/
    platforms;android-28 | 6       | Android SDK Platform 28        | platforms/android-28/
    platforms;android-29 | 4       | Android SDK Platform 29        | platforms/android-29/
    sources;android-28   | 1       | Sources for Android 28         | sources/android-28/  
    sources;android-29   | 1       | Sources for Android 29         | sources/android-29/  
    tools                | 26.1.1  | Android SDK Tools              | tools/       
  </code></pre>
  
  <p>The environment where it works is a Jenkins build wher <code>sdkmanager --list</code> shows the following:</p>
  
  <pre><code>Installed packages:
    Path                        | Version | Description                    | Location                    
    -------                     | ------- | -------                        | -------                     
    build-tools;27.0.1          | 27.0.1  | Android SDK Build-Tools 27.0.1 | build-tools/27.0.1/         
    build-tools;27.0.2          | 27.0.2  | Android SDK Build-Tools 27.0.2 | build-tools/27.0.2/         
    emulator                    | 29.0.11 | Android Emulator               | emulator/                   
    extras;android;m2repository | 47.0.0  | Android Support Repository     | extras/android/m2repository/
    extras;google;m2repository  | 58      | Google Repository              | extras/google/m2repository/ 
    patcher;v4                  | 1       | SDK Patch Applier v4           | patcher/v4/                 
    platform-tools              | 29.0.1  | Android SDK Platform-Tools     | platform-tools/             
    tools                       | 26.1.1  | Android SDK Tools              | tools/   
  </code></pre>
  
  <p>Any idea what could cause the difference in build behavior?</p>
  
  <p>Could the difference in Build Tools version (working env has 27.0.1, while not working env has 28.0.3) cause this difference?</p>
  
  <p>UPDATE: Two very similar jenkins job built with same android SDK packages listed just above produce similar different result where one compiles the code fine and another fails to compile code using hidden apis. So the difference is not the SDK package versions. What else should I look for as difference between working and not working environment?</p>