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?
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:
Keep aidl files under your custom package.
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
I ran into a similar issue. Using Android Studio, the file is required to be in a specific location unless you override it in Gradle.
I had to put the aidl file in 'src/main/aidl/example/package/name/' <-- The declared package in the aidl file would be 'package example.package.name'.
It requires the file to be in a specific aidl folder and to have a folder structure that matches the package name declared in the aidl. I found the initial hint here: https://code.google.com/p/android/issues/detail?id=56328
Eclipse displays you the errors directly in the .aidl
file, so check your file first.
I got similar issue, and found my problem: I prefixed my interface functions with public
. That was wrong. For instance:
package com.example.phone.service;
interface IService {
public void placeCall(String a, in String b, in String c);
}
should be:
package com.example.phone.service;
interface IService {
void placeCall(String a, in String b, in String c);
}
Don't forget the .java
generated file is located in gen/
not src/
.
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