title: Android How to override class in remote package with local class
body: <p>My app depends on a remote package, which is hosted in a server repository. The package is maintained independently.</p>
  
  <p>Now I want to expand a class in a remote package. I create a local copy of the same class, and make modifications on it for experiment purpose. In this way, I dont need to modify the library, push it to repository and compile my app for every debug cycle.</p>
  
  <p>However, the app compilation still uses the remote class instead of the local extended copy. And report errors.</p>
  
  <pre><code>error: cannot find symbol variable XXX_XX1
  error: cannot find symbol variable XXX_XX2
  </code></pre>
  
  <p>those variables XXX_XX1 and XXX_XX2 are newly added to the local classA</p>
  
  <p>Remote library repo: org.example.packagename.datamodel.classA</p>
  
  <p>Local source path
  .\android\app\src\mock\java\org\example\packagename\datamodel\classA.java</p>
  
  <p>My question is how to ask Android Studio to use the local copy of classA instead of teh remote one during compilation?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>After a closer examination, only those classes in the unit test folder report errors. And the main program classes do not report errors (yet, maybe it will after unit test classes are compiled).</p>
  
  <pre><code>Error:Execution failed for task ':app:compileMockDebugUnitTestJavaWithJavac'. Compilation failed; see the compiler error output for details.
  </code></pre>