In App Purchaes with Android Studio unable to find IInAppBillingService
Asked Answered
D

5

26

I am working on android project and I am using In App Purchases. It was all working in Eclipe but I saw Android Studio had another update which fixed a lot of issues related to library dependencies which does seem to be the case except for one problem. I am unable to use the IAP service as it keeps stating that it cannot be resolved to a symbol.

I have followed the instructions that someone posted here but unfortunately has not worked. Below are the links I have looked at

how can I add the aidl file to Android studio (from the in-app billing example)

https://code.google.com/p/android/issues/detail?id=56755

Below is a screenshot of my project structure and the error

Screenshot of project structure and error

Deepdyed answered 28/12, 2013 at 16:5 Comment(3)
Try to clean your build with gradlew clean and gradlew assemble and check your project. You have an error also in R.Snack
I solved with above comment,Backer
One issue I ran into was I had copied the package com.android.vending.billing from Eclipse over to Android Studio into the wrong location, and it ended up changing the package name in the IInAppBillingService.aidl file . I had to fix it manuallyProtagoras
C
31

as per info here: aidl files

Aidl files are supposed to be in src/main/aidl: per the tools docs at: tools doc

Classis answered 28/12, 2013 at 16:11 Comment(2)
This must be accepted as the right answer! I moved the package com.android.vending.billing with IInAppBillingService.aidl file into src/main/aidl directory and it compiled without any errors.Taking
This document says nothing about aidl directory: developer.android.com/google/play/billing/…Prussianism
L
10

I was getting this error even though I placed the file in right directory and was importing it in right way. Then I just did Build > Clean Project and this solved the problem.

(As far as I can guess, not sure) I think when we add .aidl file at that time android studio doesn't know about it unless we compile our project at-least once

Leahy answered 30/11, 2016 at 6:8 Comment(0)
S
5

In my case I just manually added import (after Gradle build):

import com.android.vending.billing.IInAppBillingService;
Shapely answered 31/7, 2014 at 8:18 Comment(1)
First, you may need to do Build > Clean Project.Kendo
C
4

2018

app/build.gradle:

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

for IInAppBillingService.aidl

Corset answered 8/7, 2018 at 8:3 Comment(0)
V
0

1.just create a package inside main dir (warning: Not inside app) 2.copy IInAppBillingService.aidl inside new package 3.clean project 4.rebuild project 5.import the package to neccesary class Thats it Done buddy..................

Vitellin answered 20/1, 2017 at 6:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.