title: Import android project in Intellij IDEA/use shared resources
body: <p>I have an android project in eclipse with the following structure:</p>
  
  <pre><code>|Project1
     |-src
     |-res
  
  |Project2
     |-src
     |-res
  </code></pre>
  
  <p>Project2 link to source and resource of the Project1. <em>(In Eclipse: Properties -> Java Build Path -> Source -> Link Source).</em></p>
  
  <p>I try to import the project in the IDEA with the same structure (project will be used in the Eclipse and IDEA at a time). When importing, i encountered the following problems:</p>
  
  <p><strong>1. If i add Project1 in Dependencies for Project2 (Project Structure -> Dependencies), i receive the error when trying to run Project2:</strong> </p>
  
  <blockquote>
    <p>android-apt-compiler: ...\AndroidManifest.xml:45: error: Error: Noresource found that matches the given name (at 'icon' with value'@drawable/ic_launcher')</p>
    
    <p>android-apt-compiler: ...\AndroidManifest.xml:45: error: Error: No resource found that matches the given name (at 'label' with value '@string/app_name') </p>
    
    <p>...</p>
  </blockquote>
  
  <p>But in code (Project2) i can refer to resources from Project1 without any errors.</p>
  
  <p><strong>2. Then i tried to set in Project2 path to resources directory of Project1 (Project Structure -> Facet 'Android' -> Structure), and receive error:</strong></p>
  
  <blockquote>
    <p>android-apt-compiler: ...\res\values\dimens.xml:7: error: Resource entry activity_vertical_margin is already defined.</p>
    
    <p>android-apt-compiler: ...\res\values\strings.xml:1412: error: Resource entry device_not_found is already defined. </p>
    
    <p>...</p>
  </blockquote>
  
  <p><strong>3. I also tried to add res and src folder as a content root (Project Structure -> Sources), and receive notification:</strong></p>
  
  <p>Module Project1 must not contain source root "...\Project1\src".
  The root already belongs to module "Project2".</p>
  
  <p><strong>4. And i tried set same parametres as in step 1 and additionaly make Project1 as library (Project Structure -> Facet 'Android' -> Library module). I receive errors for Project1:</strong></p>
  
  <blockquote>
    <p>java:...\Project1\src\com...\TimeLineFragment.java:276: constant
    expression required
    java:...\Project1\src\com...\TimeLineFragment.java:276: constant
    expression required</p>
  </blockquote>
  
  <p>for code like this:</p>
  
  <pre><code>@Override
  public boolean onOptionsItemSelected(MenuItem item) {
  
      switch (item.getItemId()) {
      case R.id.action_open_dial_pad:
          mDialPadListener.openDialpad();
          return true;
      case R.id.action_delete_all:
          mObserver.onDeleteAllEventsAction();
          return true;
      default:
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p>I have no more ideas how to import a project in IDEA. Is there any solution how to do this (for the described project structure), so in Eclipse all work fine?</p>