I have found a sample from the Internet (https://github.com/manishkpr/Android-AIDL-Example) and ran on Android Studio and it worked fine.
But now when I am trying to recreate the project, the Android Studio fails to recognize the .aidl file no matter where I place it. Can anybody tell me what is the right location to place .aidl files in Android Studio?
p.s. I have added the below code to build.gradle and place the .aidl file in the java directory, but failed to get it work.
sourceSets {
main {
aidl.srcDirs = ['src/main/java']
}
An AIDL file is used by Android app developers to enable communication between different apps. It contains Java source code that defines an interface, or contract, for how apps can communicate with each other. AIDL is an implementation of the Interprocess Communication (IPC) protocol provided by Android.
The Android Interface Definition Language (AIDL) is similar to other IDLs you might have worked with. It allows you to define the programming interface that both the client and service agree upon in order to communicate with each other using interprocess communication (IPC).
You need to use AIDL if you want a class outside of your application's process to access the Service. If you're only using the service from inside your application, you can use a local service.
The below link solved my issue.
https://code.google.com/p/android/issues/detail?id=56160
In my case Clean
and Rebuild
project solved my problem.
Hope this helpful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With