Donal Rafferty
Donal Rafferty

Reputation: 19826

Android - AIDL gen files causing warnings?

I have created some aidl files for IPC in my Android project.

They compile and run file however in the generated .java files I am getting warnings of un-used imports as follows:

The import android.os.Binder is never used  EngineInterface.java    /gen/com//phone/engine  line 10 Java Problem

Now I presume that they are there for a reason and since the generated file is not supposed to be modified that adding a suppress warning is not a good idea?

So how do I get rid of the warnings? I know they can be left and it doesn't affect the running of the project but I would like a clean as possible project so if its at all possible to remove this errors I would like to know how to do it.

Thanks

Upvotes: 2

Views: 2046

Answers (3)

android developer
android developer

Reputation: 115972

right click the "gen" folder->"properties"->"java compiler"->tick "ignore optional compile warnings".

that's it.

Upvotes: 4

Adam Gawne-Cain
Adam Gawne-Cain

Reputation: 24

When you have stopped developing your interface, follow these steps: 1. Copy interface Java file from "gen" source folder to main source folder 2. Change extension of your aidl file to txt, so Eclipse Android builder ignores it 3. Edit the interface Java file to remove warnings

When you copy the file in 1, you must copy into the correct package in your main source folder. Also, you will probably want to copy this file to other projects that use your service. (Incidentally, you may find it convenient to use linked folders to share interface files between projects.)

If you need to modify your interface you must either edit your Java interface file by hand, or go back to editing the aidl file and repeat steps 1 to 3.

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1007330

So how do I get rid of the warnings?

Check out the source code to the AIDL code generation tools, modify them to avoid the extraneous imports when they are truly not needed, and submit a patch to that effect to the Android open source project.

Or, just ignore them.

Upvotes: 4

Related Questions