When AIDL is in use, an error is reported. The solution for customizing the data type cannot be found,
When studying Android multi-process programming, I typed an AIDL example in the book. Android Studio automatically generates the AIDL file and puts it in the aidl folder. A custom data type is used, so there are three files in the aidl folder, as shown in.
IBookManager defines the interface provided by the server, and uses the Custom Data Type Book. In addition to using java to implement the Book class (implement parcelable is required), it also needs to add a Book with the same name. the aidl file contains two codes.
Package *. aidl;
Parcelable Book;
Everything is ready to start compilation and running.
An error is reported. When the client imports this book class, the data type cannot be found.
This is because the default java src folder in the Gradle script does not include aidl. Therefore, put the aidl folder into java src.
Add the following content to the Gradle compilation script:
SourceSets {
Main {
Java. srcDirs = ['src/main/Java', 'src/main/aidl ']
}
}
Run again, perfect.