gpt4 book ai didi

android - aidl oneway 关键字错误

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:51:32 27 4
gpt4 key购买 nike

我正在实现一个 aidl 接口(interface),由于某种原因,下面的代码给我一个错误:

// IApkinsonCallback.aidl
package com.applications.philipp.apkinson.interfaces;

/** Interface implemented by Apkinson so plugins can give feedback */
oneway interface IApkinsonCallback {
/** To be called by plugin after registration to setup data for result viewing
Usage of this data:
Intent intent = new Intent(intentActionName);
intent.putExtra(bundleResultKey, result);
startActivity(intent);
*/
void onRegistered(String intentActionName, String bundleResultKey);
/** To be called by plugin when result is ready after stopData() was called by Apkinson */
void onResult(String result);
/** Called if an error occured in the plugin and the call won't be successfully handled */
void onError(String errorMsg);
}

错误:

<interface declaration>, <parcelable declaration>, AidlTokenType.import or AidlTokenType.package expected, got 'oneway'

当我删除 oneway 关键字时,一切正常。但这不能解决我的问题...

最佳答案

总结:

oneway 关键字移动到方法级别。

解释-
这是一个与 /platform/frameworks/base/api/current.txt 有关的非常奇怪的问题Android 框架内的文件(包含每个函数并由 Android Studio 使用的大 txt 文件)。

示例-

/** Interface implemented by Apkinson so plugins can give feedback */
interface IApkinsonCallback {
/** To be called by plugin after registration to setup data for result viewing
Usage of this data:
Intent intent = new Intent(intentActionName);
intent.putExtra(bundleResultKey, result);
startActivity(intent);
*/
oneway void onRegistered(String intentActionName, String bundleResultKey);
/** To be called by plugin when result is ready after stopData() was called by Apkinson */
oneway void onResult(String result);
/** Called if an error occured in the plugin and the call won't be successfully handled */
oneway void onError(String errorMsg);
}

您将得到相同的结果但没有错误。

关于android - aidl oneway 关键字错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38632897/

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