Error in Adding the In-app Billing Library

前端 未结 9 523
轻奢々
轻奢々 2021-01-31 08:38

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
相关标签:
9条回答
  • 2021-01-31 08:49

    In the /src directory, click File > New > Package, then create a package named com.android.vending.billing

    Copy the IInAppBillingService.aidl file from /extras/google/play_billing/ and paste it into the src/com.android.vending.billing/ folder in your workspace.

    Build your application. You should see a generated file named IInAppBillingService.java in the /gen directory of your project.

    0 讨论(0)
  • 2021-01-31 08:53

    The only advice I can give you is to re-check spelling of the directories in your src folder, if you put the file into /src/com/android/vending/billing/IInAppBillingService.aidl it should work

    0 讨论(0)
  • 2021-01-31 08:54

    2018

    app/build.gradle:
    
    sourceSets {
      main {
        aidl.srcDirs = ['src/main/aidl']
      }
    }
    

    or

    sourceSets {
      main {
        aidl.srcDirs = ['src']
      }
    }
    

    for IInAppBillingService.aidl

    0 讨论(0)
  • 2021-01-31 09:02

    The other suggestions are good. Sometimes eclipse may just be weird though, and a project clean can fix it in this case.

    0 讨论(0)
  • 2021-01-31 09:02

    I did what @j2emanue suggested (click New/Package, add "com.android.vendor.billing"), and I also added that directories to my file system (com/android/vendor/billing) then copied the file in it. Then, clicked Refresh on the project. Build, and it succeeded.

    0 讨论(0)
  • 2021-01-31 09:05

    The structure that @David mentioned works fine in Android Studio 1.2.

    Your path for the billing folder should look like:

    [YOUR_APP_FOLDER]/app/src/main/aidl/com/android/vending/billing/IInAppBillingService.aidl
    

    This is where you can check the IInAppBillingService.java generated file:

    [YOUR_APP_FOLDER]/app/build/generated/source/aidl/debug/com/android/vending/IInAppBillingService.java
    

    Good luck !

    0 讨论(0)
提交回复
热议问题