First of all, this may be a duplicate, but I've searched tons of hours trying get this error fixed, and none of the found pages about this topic helped me fix my error. Here are some places I went:
- Android: AIDL refusing to generate code from aidl file defining parcelable
- AIDL ERROR while trying to return custom class object
- How to return a list of MyObject in android aidl file?
- Android Parcelable - Write and read ArrayList< IA > when IA is a interface
- (...)
Test.java (Implements Parcelable):
package com.app.pack.classes;
public class Test implements Parcelable {
private int test = 33;
protected Test(Parcel in) {
test = in.readInt();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(test);
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<Test> CREATOR = new Creator<Test>() {
@Override
public Test createFromParcel(Parcel in) {
return new Test(in);
}
@Override
public Test[] newArray(int size) {
return new Test[size];
}
};
}
Test.aidl (Declares the class I want to send):
package com.app.pack.aidl;
parcelable Test;
TestService.aidl (provides the method that returns a Test object):
package com.app.pack.aidl;
import com.app.pack.aidl.Test;
interface TestService{
Test getAll(in int[] listOfInts);
}
When I rebuild the project in the messages gradle build the outputted error says:
C:\Users...\TestService.java
- "error: cannot find symbol class Test"
Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
When I check the Gradle Console I found that the error is related to this:
"aidl.exe E 02-28 12:08:49 8288 4608 aidl.cpp:580] refusing to generate code from aidl file defining parcelable"
I've tried to put the Test.java within the same package as Test.aidl and TestService.aidl, but it didn't fix it. Also tried recreating both Test.java and Test.aidl, didn't work either. Also tried to see where the android.mk is on my project, but didn't find it, it either doesn't exist or it is on a path that I don't know. (can't find jni folder either).
Can someone please help me find an answer to why the aidl isn't working/is failing when I try to pass an object of my own? When I try to pass a primitive data type it works perfectly (example: if I try to pass an int instead of a Test, it works).