Android.mk在编译AIDL时遇到的couldn't find import for class
来源:互联网 发布:网络远程教育多少钱 编辑:程序博客网 时间:2024/05/14 20:29
今天在编译AIDL时,总是遇到couldn't find import for class问题,花了几个小时的时间才解决, 在这里把遇到的坑记录在这里,防止后面忘记! Android.mk在编译简单的AIDL(传递的只有基本数据类型)如下写法是无问题的。
例子1:LOCAL_SRC_FILES := $(call all-java-files-under, $(src_dirs)) LOCAL_SRC_FILES += src/main/java/com/royole/server/aidl/IValueContainer.aidl \ src/main/java/com/royole/server/aidl/IContainer.aidl \
但是当编译的AIDL文件中出现需要床底parcelable数据时,你会发现无法编译通过了。主要有一下2个错误:1、当一个类implement parcelable时,例如:
文件demo.java:package com.royole.aidlpublic class demo implement parcelable { ........}文件demo.aidl:package com.royole.aidlparcelabel demo;
android.mk在按照(例子1)的写法时:会有如下错误:
...VideoStatus.aidl:4 aidl can only generate code for interfaces, not parcelables or flattenables...VideoStatus.aidl:4 .aidl files that only declare parcelables or flattenablesmay not go in the Makefile.
此时去掉android.mk中该aidl的编译选项,又会有如下错误:
cannot find symbol **.VideoStatus
正确写法如下:
src_dirs = src/main/java \\java源码目录aidl_dirs = src/main/aidl \\aidl源码目录LOCAL_SRC_FILES := $(call all-java-files-under, $(src_dirs)) \ src/main/aidl/com/royole/server/aidl/VideoStatus.java \ $(call all-Iaidl-files-under, $(aidl_dirs)) \\\重点在此,有兴趣的朋友可以去了解一下此标签的具体实现**LOCAL_AIDL_INCLUDES += $(LOCAL_PATH)/$(aidl_dirs)**
注意事项:
1、src_dirs与aidl_dirs目录不要有父子关系,即src_dirs目录不要包括aidl_dirs目录,
否者依然会报错误:
cannot find symbol **.VideoStatus
2、aidl目录中的java文件不要遗漏编译了
0 0
- Android.mk在编译AIDL时遇到的couldn't find import for class
- Android aidl 编译报couldn't find import for class
- Android aidl 编译报couldn't find import for class
- Android aidl 编译错误:couldn't find import for class
- 编译Android系统AIDL模块出现couldn't find import for class错误的解决办法
- AIDL 编译报couldn't find import for class 解决方法
- AIDL couldn't find import for class
- android studio aidl couldn't find import for class
- Android AIDL编译报couldn't find import for class android.content.Intent
- 在Eclipse编译aidl文件中出现couldn't find import for class原因
- 在Eclipse编译aidl文件中出现couldn't find import for class原因
- 在Eclipse编译aidl文件中出现couldn't find import for class原因
- 在Eclipse编译aidl文件中出现couldn't find import for class原因
- Android中AIDL 编译报couldn't find import for class解决办法
- Android Studio中使用AIDL以及couldn't find import for class问题的处理
- aidl文件中出现couldn't find import for class
- AIDL 编译报couldn't find import for class原因探究
- AIDL 编译报couldn't find import for class原因探究
- 【OpenCV学习笔记】十九、图像边缘检测
- [厉害了,国的我] 萨德,“谢谢“你的出现
- Rightmost Digit(hdu1061)
- nodemcu通过MQTT协议进行通讯
- “/”应用程序中的服务器错误。未将对象引用设置到对象的实例。
- Android.mk在编译AIDL时遇到的couldn't find import for class
- Tomcat7下部署项目
- 二叉树遍历
- ACM002 IBM Minus One
- 【Hadoop】OpenTSDB部署
- mysql 启动报错--发现系统错误2,系统找不到指定的文件。
- Eclipse 报 "The builder launch configuration could not be found" 错误的解决办法
- 矩阵快速幂
- Android NDK编译C/C++为so共享对象