11

我只是想在 Android Studio 2.1 Preview 1 中使用新的预览版 SDK 24 Android N 编译我的应用程序。

我的应用中有应用内计费。

尝试构建应用程序时出现以下异常

aidl.exe E  6416  3312 io_delegate.cpp:102] Error while creating directories: Invalid argument
Error:Execution failed for task ':app:compileDebugAidl'.
> java.lang.RuntimeException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Gebruiker\AppData\Local\Android\Sdk\build-tools\24.0.0-preview\aidl.exe'' finished with non-zero exit value 1

我已经尝试使用最新的 IInAppBillingService.aidl,但仍然遇到同样的错误。当我删除 IInAppBillingService.aidl 文件时,项目编译得很好。

这是我的构建 gradle 的一部分

compileSdkVersion 'android-N'
buildToolsVersion "24.0.0 rc1"

defaultConfig {
    applicationId "xxx.myapp"
    minSdkVersion 14
    targetSdkVersion 'N'
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}

IInAppBillingService.aidl 文件位于以下文件夹中

src/main/aidl/com/android/vending/billing

如何解决这个问题?

4

4 回答 4

0

由于有关 gradle 版本不正确的警告,我已更新到最新的 Android Studio 2.0 Beta 6 并且还更新了设置以支持 Instant Run。这将我所有的 buildToolsVersion 设置更改为 24 RC 1。这开始导致此错误报告中描述的aidl 错误。我必须回到 buildToolsVersion 23.0.2 才能编译和运行。

于 2016-03-10T15:00:29.097 回答
0

我认为你必须改变以下几点

minSdkVersion 'N'compileSdkVersion 'android-N'

将您的 JAVA JDK 更新到 1.8


android {
  ...
  defaultConfig {
    ...
    jackOptions {
      enabled true
    }
  }
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
}
于 2016-03-10T04:24:21.870 回答
0

首先,最重要的一步是您需要获取有关错误的更多详细信息。

您可以使用以下 Gradle 命令之一来获取更多详细信息。

gradlew assembleDebug
gradlew assembleDebug --info
gradlew assembleDebug --debug
gradlew assembleDebug --scan
gradlew assembleDebug --stacktrace

我在环境中遇到过类似的情况:

macOS 10.14.2
Android Studio 3.3

更详细的信息是:

ifeegoo:AIDLClient ifeegoo$ ./gradlew assembleDebug

Welcome to Gradle 4.10.1!

Here are the highlights of this release:
 - Incremental Java compilation by default
 - Periodic Gradle caches cleanup
 - Gradle Kotlin DSL 1.0-RC6
 - Nested included builds
 - SNAPSHOT plugin versions in the `plugins {}` block

For more details see https://docs.gradle.org/4.10.1/release-notes.html

Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

> Configure project :app
WARNING: The specified Android SDK Build Tools version (28.0.1) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.3.0.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '28.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

> Task :app:compileDebugAidl FAILED
/Users/ifeegoo/Desktop/AIDL/AIDLClient/app/src/main/aidl/com/xb/test/IRomteAidlInterface.aidl:6: couldn't find import for class com.xb.test.IClientAidlInterface


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 /Users/ifeegoo/Library/Android/sdk/build-tools/28.0.3/aidl with arguments {-p/Users/ifeegoo/Library/Android/sdk/platforms/android-27/framework.aidl -o/Users/ifeegoo/Desktop/AIDL/AIDLClient/app/build/generated/aidl_source_output_dir/debug/compileDebugAidl/out -I/Users/ifeegoo/Desktop/AIDL/AIDLClient/app/src/main/aidl -I/Users/ifeegoo/Desktop/AIDL/AIDLClient/app/src/debug/aidl -I/Users/ifeegoo/.gradle/caches/transforms-1/files-1.1/support-compat-27.1.1.aar/5625261fa2f53d5e15ed7248754bde52/aidl -d/var/folders/vl/nvypcrfj25n20fhnmtl0t5p40000gn/T/aidl37267774351421868.d /Users/ifeegoo/Desktop/AIDL/AIDLClient/app/src/main/aidl/com/xb/test/IRomteAidlInterface.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 6s
2 actionable tasks: 1 executed, 1 up-to-date

所以最重要的详细信息是在FAILED之后

/Users/ifeegoo/Desktop/AIDL/AIDLClient/app/src/main/aidl/com/xb/test/IRomteAidlInterface.aidl:6: couldn't find import for class com.xb.test.IClientAidlInterface

最后,我发现我的 AIDL 文件位置有问题。

于 2019-01-31T08:43:54.213 回答
0

我们的 InApp 东西和 IInAppBillingService.aidl 遇到了完全相同的问题,在花了一些时间之后,并查看了未解决的 google 问题跟踪器线程,找到了(至少是暂时的)解决方案,允许我用下面的最新内容编译项目安卓 N。

它肯定不是很合法,在谷歌修复了他们需要的任何东西之后,它应该被恢复,但简而言之 - 它是用来自当前 beta Build Tools 24.0.0 rc2 的aidl.exe 替换目前稳定的一个 23.1 - 瞧,“无效参数”错误消失了:)

于 2016-04-13T11:22:16.033 回答