【发布时间】:2012-07-12 13:01:06
【问题描述】:
我正在使用 Dungeons 应用程序示例,并且我正在使用该示例中提供的 BillingService 类。
我使用的是 Java 6,@override 对我有效,但在 BillingService.java 中的这两个方法出现编译错误:
/**
* This is called when we are connected to the MarketBillingService.
* This runs in the main UI thread.
*/
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
if (Consts.DEBUG) {
Log.d(TAG, "Billing service connected");
}
mService = IMarketBillingService.Stub.asInterface(service);
runPendingRequests();
}
/**
* This is called when we are disconnected from the MarketBillingService.
*/
@Override
public void onServiceDisconnected(ComponentName name) {
Log.w(TAG, "Billing service disconnected");
mService = null;
}
有人能帮我理解为什么会这样吗?
谢谢!
【问题讨论】:
-
您面临哪些错误?你能具体说明一下吗?
-
@Ran and Bhavesh 发生的编译时间错误是我在这里留下覆盖是这样的:此行的多个标记 - BillingService 类型的 onServiceConnected(ComponentName, IBinder) 方法必须覆盖超类方法跨度>
-
您能检查一下您是在 Java 1.5 还是更低版本下编译吗?如果是这样,请更改为 1.6+...
-
我遇到了同样的问题,从 1.5 更改为 Java 1.6 对我有用。
-
看看这个问题的公认答案:@harrakiss 所说的stackoverflow.com/questions/1678122,改成 1.6 就行了。