【问题标题】:Error:Execution failed for task ':app:compileDebugAidl ProcessException错误:任务执行失败:app:compileDebugAidl ProcessException
【发布时间】:2017-05-18 15:12:53
【问题描述】:

我无法建立 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
成分.aidl
java->
成分.java

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

【问题讨论】:

标签: android aidl


【解决方案1】:

将构建工具更改为

buildToolsVersion "21.0.1"

【讨论】:

    【解决方案2】:

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

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

    例如:

    矩形.aidl

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

    【讨论】:

      【解决方案3】:

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

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

      【讨论】:

        【解决方案4】:

        对我来说,当我在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);
        

        【讨论】:

          【解决方案5】:

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

          【讨论】:

            【解决方案6】:

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

            【讨论】:

              【解决方案7】:

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

              【讨论】:

                猜你喜欢
                • 2015-10-03
                • 1970-01-01
                • 2018-02-17
                • 2018-06-06
                • 2016-02-16
                • 2017-12-18
                • 2016-06-27
                相关资源
                最近更新 更多