28

I am trying to implement In app billing service in my Andorid application.

I've added the IMarketBillingService.aidl file to my project in Eclipse. Then Eclipse autogenerated the IMarketBillingService.java file, but with many errors.

@Override public android.os.IBinder asBinder() { return mRemote; }
- implements android.os.IInterface.asBinder
- The method asBinder() of type IMarketBillingService.Stub.Proxy must override asuperclass  method

@Override public android.os.Bundle sendBillingRequest(android.os.Bundle bundle) throws android.os.RemoteException
{
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
android.os.Bundle _result;
......
}
- The method sendBillingRequest(Bundle) of type IMarketBillingService.Stub.Proxy must override a superclass method
- implements com.android.vending.billing.IMarketBillingService.sendBillingRequest 

Can anyone help me with this?

I am using Mac, Eclipse Juno with last version of Android SDK.

Praveen Vinny
  • 2,372
  • 6
  • 32
  • 40
Michal
  • 543
  • 6
  • 7

4 Answers4

78

You might try to use default compile options.

  1. Right-click (or Control-Click) the project and select "Properties"
  2. Select "Java Compiler"
  3. Uncheck "Enable Project Specific Settings"

Eclipse will prompt to re-compile and it should be all good.

FabienAndre
  • 4,514
  • 25
  • 38
Zedifire
  • 796
  • 6
  • 2
  • For future reference, it's changing the Java compiler compliance level from 1.5 to 1.6+ that fixes this error. If you have to turn project-specific settings on or off to do so, that's incidental. – Sterling Jul 13 '14 at 16:52
4

Was also getting numerous errors in the generated IInAppBillingService.java. I tried many, many suggested solutions without success. Finally a variant of Zedifire's method worked on my Eclipse SDK. (these steps are from memory - try around until it works!)

  1. turned off >Project>Build Automatically
  2. deleted the /gen files
  3. THEN went to >Window>Preferences>Java>Compiler and found that somehow compliance level had defaulted to 1.5
  4. changed compliance back to level 1.7
  5. >Project>Clean
  6. >Project>Build All (still errors!)
  7. Right clicked on project window >android tools>fix project properties

VOILA -the generated files finally compiled without the errors!

Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179
ajay1865
  • 61
  • 2
1

Project-->clean and build may solve it as well

DevByStarlight
  • 1,070
  • 13
  • 17
0

The reason is, that Java 1.5 does not support overriding interface methods. https://stackoverflow.com/a/212642/1283492 From Java 1.6 onwards it is allowed. Thus as already stated by easycheese, one needs to put Java 1.6 or higher in the java compiler settings of the project properties.

Community
  • 1
  • 1