You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android项目中Kotlin文件无法导入AIDL接口的问题求助

Android项目中Kotlin文件无法导入AIDL接口的问题求助

我翻了好几个相关帖子,可还是搞不明白怎么在Kotlin文件里正确导入AIDL文件,想请各位大佬帮忙分析下问题出在哪!

先给大家看下我的项目目录结构:

src/
├── main/
│   ├── java/
│   │   └── com/
│   │       └── abc/
│   │           └── project/
│   │               └── MyTest.kt
│   └── aidl/
│       └── com/
│           └── xyz/
│               └── example/
│                   └── ISomeService.aidl

我在MyTest.kt里写了这样的代码:

package com.abc.project

import com.xyz.example.ISomeService

结果直接报了这个错误:

error: unresolved reference: xyz

另外,这是我Android.bp里的相关代码片段:

aidl_interface {
    name: "aidl-example-interface",
    unstable: true,
    srcs: [
        "src/main/aidl/com/xyz/example/ISomeService.aidl",
    ],
    local_include_dir: "src/main/aidl",
}

真的非常感谢各位能给我一些解决思路!

内容来源于stack exchange

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.08 12:14:32