AIDL file does not generated a Java file

pablo.mj picture pablo.mj · Sep 21, 2012 · Viewed 9.9k times · Source

I have defined an AIDL android interface to make available a service from other applications.

My problem is that in my project, Android does not generate the Java file from this AIDL. Note that the project compiles and works fine. However, if I move this AIDL file to another project, Android generates the Java file.

I don't know where I can debug this kind of error or where I can read some log about this.

Can anybody help me?

Answer

Luna Kong picture Luna Kong · Mar 26, 2018

I met the same issue and work fine for me on Android Studio. There are two ways to fix this.

Method 1:

Put AIDL files under src/main/aidl package to follow default source setting for gradle build.

It is easy way but not be smart.

Method 2:

  1. Keep aidl files under your custom package.

  2. Add source setting mapping in build.gradle file as below

    sourceSets {
       main {
         aidl.srcDirs = ['src/main/java']
       }
    }
    

Don't forget clean and rebuild after setting as above.

More information please refer this,

https://issuetracker.google.com/issues/36972230

https://issuetracker.google.com/issues/36972230

https://issuetracker.google.com/issues/36988483