views:

353

answers:

2

Hi,

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

+2  A: 

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.

CommonsWare
+1  A: 

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.

Adam Gawne-Cain