title: Android Studio Gradle - local.properties variable(path) in settings.gradle
body: <p>I'm trying to implement an flow so that it won't affect my version control when other people need to work on the project.</p>
  
  <p>Currently I have an library module added into current project from another project. This I have done via the settings.gradle file like this:</p>
  
  <pre><code>include ':MainModule', ':ExternalModule'
  project(':ExternalModule').projectDir = new File('C:\\Projects\\AnotherProject\\libraryModule')
  </code></pre>
  
  <p>My problem is that if I do this, I affect all other developers that work on the project and every time someone pushes to the repository, this file will be changed. I want to avoid this.</p>
  
  <p>I was thinking to add the path of the external library module in the local.properties which is not pushed to the repository and handled by each developer. I did something like this:</p>
  
  <pre><code>include ':MainModule', ':ExternalModule'
  project(':ExternalModule').projectDir = new File(getExternalModuleDir())
  
  def getExternalModuleDir() {
      Properties properties = new Properties()
      properties.load(project.rootProject.file('local.properties').newDataInputStream())
      def externalModuleDir = properties.getProperty('module.dir', null)
      if (externalModuleDir == null)
          throw new GradleException("Module location not found. Define location with module.dir in the local.properties file!")
  
      return externalModuleDir 
  }
  </code></pre>
  
  <p>But I get the following error:</p>
  
  <blockquote>
    <p>Could not find property 'project' on settings 'AwesomeProject'.</p>
  </blockquote>
  
  <p>I think this is because settings.gradle does not have access to the local.properties (or the settings.gradle is called before the local.properties, I really do not know for sure the exact flow).</p>
  
  <p>I do something wrong? The flow that I want to achieve is correct? What is the correct way to do something like this?</p>