title: Developing AOSP with Android Studio
body: <p>I'm trying to setup a development environment to do some custom modifications on the AOSP source code, and would like to use Android Studio as my IDE. After doing the necessary steps, however, Android Studio seems to not be able to recognize some of the classes and methods. Did I do something wrong? Here's a rundown of what I did:</p>
  
  <p>I did the necessary preparations (dependencies, etc.) for cloning and building AOSP according to the official documentation. After that, I cloned the AOSP 7.1.1-r11 branch with repo, and then ran the following commands:</p>
  
  <pre><code>$ source build/envsetup.sh
  $ lunch aosp_arm-eng
  $ make
  $ mmm development/tools/idegen/
  $ development/tools/idegen/idegen.sh
  </code></pre>
  
  <p>The make took me about an hour, running the idegen.sh took me around 5 seconds.</p>
  
  <p>The idegen.sh generated an android.ipr file which I successfully imported in Android Studio. When prompted with an SDK selection, I selected openjdk 1.8.0_121 and removed all the libraries in the classpath, as indicated in the idegen readme file.</p>
  
  <p>After letting Android Studio run the initial import actions, I went ahead and opened the PhoneFactory.java from the telephony framework where I want to do my modifications. Here is where I have my problem: several dozen methods are in red (cannot be resolved).</p>
  
  <p>I am sure there is no problem with how I cloned AOSP, as the make passes correctly. Any ideas?</p>