2
votes

I've been trying to implement Google In-App Billing into one of my Android apps by following http://developer.android.com/training/in-app-billing/preparing-iab-app.html#GetSample but I get the error that "IabHelper cannot be resolved to a type" after following the steps for an "Existing Project". I've added a picture as well. enter image description here

3
Did you do step 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."Ken Wolf
yes. I believe I have a package for that, which I imported it with the Base64 classes, but still no solution.clever_trevor
I copied 9 classes from com.example.android.trivialdrivesample.util to my project. IabHelper is one of them and is what your code should resolve to.Ken Wolf

3 Answers

12
votes

Make sure you have followed step 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.

You need to copy all the classes under com.example.android.trivialdrivesample.util and put them in your project. IabHelper is one of them and seems to be what you are missing.

enter image description here

0
votes

so this worked for me:

If you just copied the files, then you need to change the package name of each java file in the util folder...

0
votes

I have misunderstood where to copy the helper classes to? I am not able to read that from images provided. I have all of them changed accordingly to my app however still struggling on where to copy these files to. Neither able to understand that from https://developer.android.com/training/in-app-billing/preparing-iab-app.html#SetPermission as I do not have util folder in my app.