每个人。
我刚开始在我的应用程序中进行应用内购买。
这对我来说是新事物。
现在在网上看到了一些例子,我发现github上的一个项目在我把billing库链接到它之前充满了错误。
我做的时候只是解决了项目中的错误,但是还是出现红色感叹号,因为android计费库包有错误。
我检查了错误,但我无法解决它,因为我不明白如何解决。
伙计们,我真的需要一些帮助。
我在这些行中得到了错误
@Override
public android.os.IBinder asBinder()
{
return this;
}
在 asBinder 中,错误及其说法“此行有多个标记”
- The method asBinder() of type IMarketBillingService.Stub must override a superclass method
- implements android.os.IInterface.asBinder"
与此代码相同,我也收到错误
@Override
public android.os.Bundle sendBillingRequest(android.os.Bundle bundle) throws android.os.RemoteException
{
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
android.os.Bundle _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
if ((bundle!=null)) {
_data.writeInt(1);
bundle.writeToParcel(_data, 0);
} else {
_data.writeInt(0);
}
mRemote.transact(Stub.TRANSACTION_sendBillingRequest, _data, _reply, 0);
_reply.readException();
if ((0!=_reply.readInt()))
{
_result = android.os.Bundle.CREATOR.createFromParcel(_reply);
} else {
_result = null;
}
}
finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
}
static final int TRANSACTION_sendBillingRequest = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0);
}
我不知道这些错误是什么。
我只是按原样得到了这个库,并将它放在了我的 Eclipse 项目中。
错误出现在 InAppBillingService 中,我无法访问它,因为它是自动生成的!!
提前致谢。
最佳答案
在生成的 IInAppBillingService.java 中出现了很多错误。我尝试了很多很多建议的解决方案,但都没有成功。最后,Zedifire 方法的一种变体适用于我的 Eclipse SDK。 (这些步骤来自内存 - 尝试直到它起作用!)
关闭>项目>自动构建 删除了/gen 文件 然后转到 >Window>Preferences>Java>Compiler 并发现合规级别默认为 1.5 将合规性更改回 1.7 级
Project>Clean Project>Build All (still errors!) Right clicked on project window >android tools>fix project properties
关于安卓计费库错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14775118/