在 aidl(ipc) 中传递自定义数组列表

Passing custom arraylist in aidl(ipc)

我正在尝试在进程间通信中传递自定义数组列表。 我制作了两个这样的 aidl 文件

IMyAidlInterface.aidl

package com.amaze.DrivePlugin;
import com.amaze.DrivePlugin.Layoutelements;
// Declare any non-default types here with import statements
interface IMyAidlInterface {
    /**
     * Demonstrates some basic types that you can use as parameters
     * and return values in AIDL.
     */
    ArrayList<Layoutelements> list(in String driveID);
}

此处 Layoutelements 是一个自定义 class 实现 parcelable

Layoutelements.aidl

package com.amaze.DrivePlugin;

// Declare any non-default types here with import statements
parcelable Layoutelements;

错误说 "unknown return type arraylist"。

我也尝试导入 arraylist 但没有帮助

使用java.util.List代替ArrayList通常可以解决问题