gpt4 book ai didi

Android:AIDL 拒绝从定义 parcelable 的 aidl 文件生成代码

转载 作者:太空狗 更新时间:2023-10-29 15:25:26 25 4
gpt4 key购买 nike

我正在尝试使用 aidls 构建一个库。

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := test

LOCAL_SRC_FILES := $(call all-java-files-under, java) \
java/com/testapp/Istudent.aidl \
java/com/testapp/Itest.aidl \

LOCAL_PREBUILT_JAVA_LIBRARY := framework.jar
include $(BUILD_JAVA_LIBRARY)

我正在尝试推荐 Itest 中的 Istudent。

学生.aidl

package com.testapp;

parcelable Istudent;

学生.java

public class Istudent implements Parcelable{}

Itest.aidl

package com.testapp;

import com.testapp.Istudent;

interface IAP2InterfaceBase {}

但我收到的错误是 E 07-​​11 20:05:37 71066 71066 aidl.cpp:580] refusing to generate code from aidl file defining parcelable

请告诉我“拒绝从定义 parcelable 的 aidl 文件生成代码”是什么意思?我在这里做错了什么..

最佳答案

Error原因可以根据aidl源码理解如下:

https://github.com/debian-pkg-android-tools/android-platform-system-tools-aidl/blob/master/aidl.cpp行:536

if (!interface) {
LOG(ERROR) << "refusing to generate code from aidl file defining "
"parcelable";
return AidlError::FOUND_PARCELABLE;
}

此外,如 https://developer.android.com/guide/components/aidl.html 中所述,声明可打包类的 aidl 文件不应包含在构建中在“通过 IPC 传递对象”下。以下是从网站复制的代码段。

Finally, create an .aidl file that declares your parcelable class (as shown for the Rect.aidl file, below). If you are using a custom build process, do not add the .aidl file to your build. Similar to a header file in the C language, this .aidl file isn't compiled.

关于Android:AIDL 拒绝从定义 parcelable 的 aidl 文件生成代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45043696/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com