我正在实现一个aidl接口,由于某种原因,下面的代码给了我一个错误:
// 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);
}
Run Code Online (Sandbox Code Playgroud)
错误:
<interface declaration>, <parcelable declaration>, AidlTokenType.import or AidlTokenType.package expected, got 'oneway'
Run Code Online (Sandbox Code Playgroud)
当我删除oneway关键字时,一切正常.但这不能解决我的问题......
将oneway关键字移动到方法级别.
解释 -
这是与/platform/frameworks/base/api/current.txtAndroid框架内的文件相关的非常奇怪的问题(包含所有功能并由Android Studio使用的Big 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);
}
Run Code Online (Sandbox Code Playgroud)
您将得到相同的结果,但没有错误.
| 归档时间: |
|
| 查看次数: |
1518 次 |
| 最近记录: |