Can't use .aidl files across library projects?

我的未来我决定 提交于 2019-12-01 06:49:05

问题


In the spirit of re-using code, I'm trying to create a few library projects. However, I seem to run into a problem defining .aidl files that span the libraries. Here is the problem:

In library A I have Foo.java and Foo.aidl. Foo.java is Parcelable so the aidl declaration is:

Foo.aidl:

package com.example.library.A;
parcelable Foo;

Now I'm trying to create library B. In library B I want to define a service interface that uses class Foo:

IMyService.aidl:

package com.example.library.B;
import com.example.library.A.Foo;

interface IMyService {
    void requestSomething(in Foo fooBug);
}

This file does not compile complaining that it couldn't find the import for Foo. I've tried referencing library A and I've tried adding the library project as an external jar, but neither work.

Is there a limitation that I don't know about? Am I doing something wrong with my project setup??

I should probably mention that I've used library A directly in a project with no problem so I'm confident that lib A is not the problem.


回答1:


I have it working, but I'm not happy with the solution. In lib B, I had to add a com.example.library.A package and copy the Foo.aidl file into it.



来源:https://stackoverflow.com/questions/9277536/cant-use-aidl-files-across-library-projects

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!