不能使用.aidl文件跨库项目? [英] Can't use .aidl files across library projects?

查看:186
本文介绍了不能使用.aidl文件跨库项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在重新使用code的精神,我试图创建一些库项目。但是,我似乎碰到定义.aidl跨越的库文件存在问题。这里的问题是:

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:

在库中的我有Foo.java和Foo.aidl。 Foo.java是Parcelable所以AIDL声明是:

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;

现在我试图创建库B.在库B I要定义使用类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);
}

该文件不编译抱怨它无法找到富进口。我试过引用库中的一个,我已经尝试添加库项目作为一个外部JAR,但既不工作。

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??

我也许应该提及我用库中的直接,没有问题,所以我相信一个项目,lib目录是没有问题的。

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.

推荐答案

我有工作,但我不开心的解决方案。在LIB B,我不得不添加一个com.example.library.A包并拷贝文件Foo.aidl到它。

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.

这篇关于不能使用.aidl文件跨库项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆