问题
I've got some AIDL files which I want to include in a project, however Eclipse seems to work differently on different projects.
I'm developing an SDK for an application, and in the SDK android project the AIDL file generates the correct .java file, but in the main application Eclipse is not even attempting to build it.
Update: I found a log file and it says this:
!ENTRY com.android.ide.eclipse.adt 4 0 2012-04-21 19:22:11.043
!MESSAGE Failed to run one of the source processor
!STACK 0
java.lang.NullPointerException
at com.android.ide.eclipse.adt.internal.build.AidlProcessor.doCompileFiles(AidlProcessor.java:109)
(include rest of stack here...)
Joe
回答1:
I had this exact issue happen to me today. It turns out this happens when there are source folders in your project that do not actually exist.
So verify in your project Java Build Path that all source folders actually exist. After removing a dead source folder link from there my project once again compiled the aidl.
回答2:
From my experience you create the .aidl file in your project (make sure your included packages are correct - you will get an error if not). If the .aidl file is good a .java file will be created in the gen/ directory under the correct package name.
Next you must connect your java code to the interface using
<YourAidlClassName>.Stub myAidlInterface = new <YouAidlClassName>.Stub() {
// Your AIDL interface methods will appear in here and can now be used
// in your application as myAidlInterface.methodName();
}
Hope this helps.
回答3:
Okay, I don't understand this but for some reason 12.04 of ubuntu flagged up an error.
On one project I could called the file IAPPNAMEConect.aidl
but the other wanted it as IAPPNAMEService.aidl
I completely forgot about Java's strictness there
来源:https://stackoverflow.com/questions/10261781/aidl-files-not-building-in-eclipse-in-random-projects