前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Android中framework层下添加aidl编译说程序包不存在

Android中framework层下添加aidl编译说程序包不存在

作者头像
fanfan
发布2022-05-07 15:00:02
1.2K0
发布2022-05-07 15:00:02
举报
文章被收录于专栏:编程思想之路编程思想之路

因为特殊要求,我在framework层下添加了一个aidl文件IBluetoothShp.aidl文件,但是在编译时却说程序包不存在,错误如下

代码语言:javascript
复制
frameworks/base/core/java/android/bluetooth/BluetoothShp.java:227: 错误: 找不到符号
    private IBluetoothShp mService;
            ^
  符号:   类 IBluetoothShp
  位置: 类 BluetoothShp
frameworks/base/core/java/android/bluetooth/BluetoothShp.java:281: 错误: 找不到符号
        Intent intent = new Intent(IBluetoothShp.class.getName());
                                   ^
  符号:   类 IBluetoothShp
  位置: 类 BluetoothShp
frameworks/base/core/java/android/bluetooth/BluetoothShp.java:895: 错误: 程序包IBluetoothShp不存在
            mService = IBluetoothShp.Stub.asInterface(service);
                                    ^
注: 某些输入文件使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: 某些输入文件使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
3 个错误
make: *** [out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar] 错误 41

#### make failed to build some targets (01:25 (mm:ss)) ####

可是framework目录下明明存在该文件啊

纠结了好久终于找到了该问题,在此记录一下,在framework层下的.mk文件中将你新添加的aidl添加进去,像我这个错误,我是在framework/base/../../,下添加的aidl,找到base下的Android.mk文件,然后添加以下一段话

代码语言:javascript
复制
	core/java/android/bluetooth/IBluetoothShp.aidl \

.mk文件下某段代码如下:

列出直接传递给编译器的源代码文件

可以在该文件中看到:

代码语言:javascript
复制
## READ ME: ########################################################
##
## When updating this list of aidl files, consider if that aidl is
## part of the SDK API.  If it is, also add it to the list below that
## is preprocessed and distributed with the SDK.  This list should
## not contain any aidl files for parcelables, but the one below should
## if you intend for 3rd parties to be able to send those objects
## across process boundaries.
###guoyongcan merge from nxp patch 20160428 line:200
## READ ME: ########################################################
LOCAL_SRC_FILES += \
	core/java/android/accessibilityservice/IAccessibilityServiceConnection.aidl \

每当往sdk中添加aidl文件时,要将其添加到如下列表,这个列表不包含任何打包的aidl文件,如果你希望第三方可以跨进程通信发送对象可以添加进去

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016-06-15,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档