错误:任务':app:compileDebugAidl ProcessException的执行失败

问题描述 投票:4回答:7

我无法建立Aidl图书馆。 错误:

错误:任务':app:compileDebugAidl'的执行失败。 java.lang.RuntimeException:com.android.ide.common.process.ProcessException:执行时出错 带参数的'D:\ mysdk \ Android \ android-sdk \ build-tools \ 22.0.1 \ aidl.exe' {-pD:\ mysdk \ Android \ android-sdk \ platforms \ android-21 \ framework.aidl -... dC:\ Users \ admin \ AppData \ Local \ Temp \ aidl6013369886374174489.d ... \ dev \ myaidllibrary \ ICoffeeMakerRemoteService.aidl}

的build.gradle:

apply plugin: 'com.android.library'
apply plugin: 'com.neenbedankt.android-apt'
android {
    compileSdkVersion 21
    buildToolsVersion '22.0.1'
    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:21.0.0'
    testCompile 'junit:junit:4.12'
    provided 'com.google.auto.value:auto-value:1.2-rc1'
    // needed for Android Studio
    apt 'com.google.auto.value:auto-value:1.2-rc1'
    apt 'com.ryanharter.auto.value:auto-value-parcel:0.2.0'
}

目录结构:

aidl-> ICoffeeMakerRemoteService.aidl Ingredient.aidl 基于Java> Ingredient.java

我坚持使用这些,尝试了可能的解决方案。

android aidl
7个回答
3
投票

我犯了同样的错误,但我修好了。我想你想“通过IPC传递对象”,我也是。

我的问题是我错过了对象aidl中的包定义,例如Ingredient.aidl,所以请尝试将包添加到您的aidl文件中。

例如:

Rect.aidl

package android.graphics;  // important

// Declare Rect so AIDL can find it and knows that it implements
// the parcelable protocol.
parcelable Rect;

2
投票

对我来说,当我在aidl中定义具有不同签名的重载方法时会发生这种情况。好像不支持重载方法。

不允许:

public void methodA(int a);
public void methodA(int a, String b);

允许:

public void methodA(int a);
public void methodB(int a, String b);

发现更多是不允许的,无法在签名中定义字符串数组不允许:

public void methodA(String[] a);

1
投票

我在左侧导航栏上重命名了aidl的包,并且与***。aidl中的代码一致。


0
投票

将构建工具更改为

buildToolsVersion "21.0.1"

0
投票

https://github.com/frankiesardo/icepick/issues/46

1.Delete android/app/build Folder
2.build -> clean
3.build -> rebuild
try again.

0
投票

尝试使用--debug选项构建并查找“可以是out类型,因此您必须将其声明为in,out或inout。”


0
投票

我遇到了同样的错误。原因是我复制到客户端应用程序的.aidl文件访问该服务不在正确的包下。只需尝试创建包,并确保将aidl文件复制到应用程序的正确包名称下。

© www.soinside.com 2019 - 2024. All rights reserved.