title: Android Studio: How to import AIDL file from a different Android Studio project?
body: <p>One Android Studio project contains a no-activity service, to be communicated with via <code>IMyAidlInterface</code> (belonging to package com.example.tutorialspoint7.noactivity). </p>
  
  <p>Another Android Studio project contains an activity-only application, for the sole purpose of testing the aforemention service (assume a different package, e.g. com.example.tutorialspoint7.aidlactivity)</p>
  
  <p>Without any special configuration, the aidlactivity project does not know about the noactivity project and thus, any reference to IMyAidlInterface in aidlactivity gets <em>"Cannot resolve symbol IMyAidlInterface"</em>.</p>
  
  <p>I searched for a way to let the aidlactivity project to know about that AIDL file, but all "solutions" I found were actually workarounds duplicating the file and adding it as in this example:  <a href="https://stackoverflow.com/a/16906355/5556250">https://stackoverflow.com/a/16906355/5556250</a></p>
  
  <p>So, I turned into manually tweaking the app's build.gradle by adding the following into it:</p>
  
  <pre><code>android {
      compileSdkVersion 24
      buildToolsVersion "25.0.2"
      defaultConfig {
          applicationId "com.example.tutorialspoint7.aidlactivity"
          minSdkVersion 16
          targetSdkVersion 24
          versionCode 1
          versionName "1.0"
          testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  
      sourceSets {
          main.java.srcDirs += '../../NoActivity/app/src/main/aidl/com/example/tutorialspoint7/noactivity'
      }
  }
  </code></pre>
  
  <p>I then synced it and, how wonderful, it is now part of the aidlactivity project:</p>
  
  <p><a href="https://i.stack.imgur.com/XGxJp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XGxJp.png" alt="enter image description here"></a></p>
  
  <p>But... AIDLActivity still gets <em>"Cannot resolve symbol IMyAidlInterface"</em>.</p>
  
  <p>What do I need to do now to get it to recognize the file?</p>