Android中framework层下添加aidl编译说程序包不存在
16lz
2021-01-23
因为特殊要求,我在framework层下添加了一个aidl文件IBluetoothShp.aidl文件,但是在编译时却说程序包不存在,错误如下
frameworks/base/core/java/android/bluetooth/BluetoothShp.java:227: 错误: 找不到符号 private IBluetoothShp mService; ^ 符号: 类 IBluetoothShp 位置: 类 BluetoothShpframeworks/base/core/java/android/bluetooth/BluetoothShp.java:281: 错误: 找不到符号 Intent intent = new Intent(IBluetoothShp.class.getName()); ^ 符号: 类 IBluetoothShp 位置: 类 BluetoothShpframeworks/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文件,然后添加以下一段话
core/java/android/bluetooth/IBluetoothShp.aidl \
.mk文件下某段代码如下:
列出直接传递给编译器的源代码文件
可以在该文件中看到:
## 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文件,如果你希望第三方可以跨进程通信发送对象可以添加进去
更多相关文章
- 修改Android中strings.xml文件
- Android获取sd卡上的文件目录-日记
- PC上安装android market软件并提取apk文件
- 通过终端命令生成并在手机上运行dex文件
- android 程序错误全局处理
- Android Studio ——Android 使用Pull方法解析XML文件的方法
- Android的raw下视频文件的读写-日记
- 成功解决 Android 下载中文文件名