本文介绍了添加应用内结算库时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照。


  1. IInAppBillingService.aidl 文件复制到您的Android项目中。


    (1)如果您使用的是Eclipse:将 IInAppBillingService.aidl 文件导入到您的/ src目录中。


    (2)If您正在非Eclipse环境中开发:创建以下目录/ src / com / android / vending / billing并将 IInAppBillingService.aidl 文件复制到此目录中。


  2. 构建您的应用程序。您应该在项目的 / gen 目录中看到名为 IInAppBillingService.java 的生成文件。

  3. TrivialDrive 样本的 / util 目录中的助手类添加到您的项目中。请记住相应地更改这些文件中的包名称声明,以便您的项目可以正确编译。

但是当我完成时,Eclipse给了我一个错误:

 接口IInAppBillingService应该在名为com \android\vending\billing\IInAppBillingService的文件中声明。 AIDL。 

aidl 文件位于正确的目录中,但未生成 IInAppBillingService.java 文件。



以前有人看过吗?

解决方案

右键点击然后创建一个新的PACKAGE ...调用包com.android.vending.billing ....将aidl文件放在那里以清除错误。

一些需要思考的食物:对于那些有兴趣的人 - 当使用某人的aidl文件时,两个应用程序的包名称必须相同。谷歌使用com.android.vending.billing作为他们的计费aidl接口的包名,所以你也必须在你的应用中使用相同的包名称。这是使用aidl时的规则。

I was doing this following these steps as mentioned in the link.

  1. Copy the IInAppBillingService.aidl file to your Android project.

    (1) If you are using Eclipse: Import the IInAppBillingService.aidl file into your /src directory.

    (2) If you are developing in a non-Eclipse environment: Create the following directory /src/com/android/vending/billing and copy the IInAppBillingService.aidl file into this directory.

  2. Build your application. You should see a generated file named IInAppBillingService.java in the /gen directory of your project.
  3. Add the helper classes from the /util directory of the TrivialDrive sample to your project. Remember to change the package name declarations in those files accordingly so that your project compiles correctly.

But when I finished that, Eclipse gives me an error:

interface IInAppBillingService should be declared in a file called com\android\vending\billing\IInAppBillingService.aidl.

the aidl file is in the correct directory, but the IInAppBillingService.java file was not generated.

Has anybody seen that before?

解决方案

right click on the head of the project and create a new PACKAGE ... call the package com.android.vending.billing ....drop the aidl file in there to quiet the error.

Some food for thought: for those with an interest - when using someone's aidl file, the package name for both apps must be the same. google used com.android.vending.billing as their package name for their billing aidl interface, so you MUST also use the same package name in your app. This is the rule when using aidl.

这篇关于添加应用内结算库时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 20:14