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

下面试是使用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 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包不一致。

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

 

 

 

你可能感兴趣的:(Android)