Search code examples
androidin-app-billing

In-app billing - error in generated IInAppBillingService.java


Trying to use in-app billing V3 for the first time, targeting Android 2.2 (API level 8), using Eclipse.

Created a package (in /src) called com.android.vending.billing, dropped (imported) IInAppBillingService.aidl into it. But /gen now contains build errors, eg for

@Override public int isBillingSupported(int apiVersion, java.lang.String packageName, java.lang.String type) throws android.os.RemoteException

it says "The method isBillingSupported(int, String, String) of type IInAppBillingService.Stub.Proxy must override a superclass method ... ".

It recommends I remove the @override but this is a google supplied file and I don't want to change it. What's gone wrong?

Cleaning and rebuilding doesn't help.


Solution

  • You will get this error if you are using Java 5. Java 5 has a few problems with the @Override annotation.

    You need to make sure you jave Java 6 installed, and then you can change the version used for building by going to Project -> Properties -> Java Compiler and checking the Enable project specific settings box and changing the Compiler compliance level: value to 1.6

    Android Tools don't play nice with Java 7, so don't use 1.7.