AIDL自定义类型的错误 java.io.IOException: com.android.ide.common.process.ProcessException

博客讲述使用AIDL自定义类型时的报错情况,给出了报错信息。指出主要原因一是使用实体类如User时未导包,二是实体类包路径不一致。并针对这两种情况分别给出解决办法,即添加导包注释和修改路径使其一致。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

下面试是使用AIDL自定义类型的时候报错

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugAidl'.
> java.io.IOException: com.android.ide.common.process.ProcessException: Error while executing process

************\build-tools\28.0.3\aidl.exe with arguments {-p***********\platforms\android-28\framework.aidl -o项目路径************\AIDLProject\app\build\generated\source\aidl\debug -I项目路径************\AIDLProject\app\src\main\aidl -I项目路径************\AIDLProject\app\src\debug\aidl -I*********\.gradle\caches\transforms-1\files-1.1\support-media-compat-28.0.0.aar\603a1f43bb93b12a708e43ecc10e38b6\aidl -I**********.gradle\caches\transforms-1\files-1.1\support-compat-28.0.0.aar\6ed01e7f5bc04a55d971544262d61197\aidl -I*************\.gradle\caches\transforms-1\files-1.1\versionedparcelable-28.0.0.aar\6efabf3bec0ee26f76ed534c5005be05\aidl -d*************\AppData\Local\Temp\aidl2217741360528241917.d 项目路径************\\AIDLProject\app\src\main\aidl\project\com\aidlproject\AIDLService.aidl}

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 7s
主要的原因是因为我使用实体类如User的时间没有导包或者路径不一致;

第一种情况没有导包如下:

package com.project.aidlproject;
parcelable User;
package project.com.aidlproject;
//import com.project.aidlproject.User;

// Declare any non-default types here with import statements

interface AIDLService {
    /**
     * Demonstrates some basic types that you can use as parameters
     * and return values in AIDL.
     */
    List<User> getBookList();

    void addUser(in User user);
    void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat,
            double aDouble, String aString);
}

解决办法:由于没有导包直接使用,所以导致找不到User,把注释import com.project.aidlproject.User加上就好了。

第二种情况就是

package com.project.aidlproject;

parcelable Book;

与User.java包不一致。

解决办法就是把路径改成一致

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值