11

I was just trying to compile my app with the new preview SDK 24 Android N in Android Studio 2.1 Preview 1.

I have in app billing in my app.

When trying to build the app I get the following exception

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

I already tried to use the latest IInAppBillingService.aidl but I still get the same error. When I remove the IInAppBillingService.aidl file the project compiles fine.

Here's a part of my build 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
}

The IInAppBillingService.aidl file is in the following folder

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

How to fix this?

Brianvdb
  • 666
  • 1
  • 6
  • 16
  • This is a defect. There's an open ticket on this: https://code.google.com/p/android/issues/detail?id=202972 – Shlublu Apr 13 '16 at 11:27
  • Possible duplicate of [aidl.exe Error while creating directories: Invalid argument](http://stackoverflow.com/questions/36498503/aidl-exe-error-while-creating-directories-invalid-argument) – VitaliyG May 27 '16 at 06:37

4 Answers4

0

I think you have to change below points

minSdkVersion 'N' and compileSdkVersion 'android-N'

update your JAVA JDK to 1.8


android {
  ...
  defaultConfig {
    ...
    jackOptions {
      enabled true
    }
  }
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
}
Dhaval Parmar
  • 18,812
  • 8
  • 82
  • 177
  • Also tried that but it results in the same exception. I reported the issue on the [google issue tracker](https://code.google.com/p/android/issues/detail?id=202972), seems like it is a defect. – Brianvdb Mar 10 '16 at 12:43
0

I had updated to the latest Android Studio 2.0 Beta 6 and had also updated the Settings to support Instant Run due to warning about gradle version not correct. This changed all my buildToolsVersion settings to 24 RC 1. That started causing the aidl error described in this bug report. I had to go back to buildToolsVersion 23.0.2 to be able to compile and run.

0

Got exactly the same problem with our InApp stuff and IInAppBillingService.aidl and after spending some time on it, and looking through the unsolved google issue tracker thread, found (at least temporarily) solution that allows me to compile the project with the latest stuff under Android N.

It surely is not quite legit, and after Google fixes whatever they need to, it shall be reverted, but in short - it is to replace the aidl.exe from the current beta Build Tools 24.0.0 rc2 with the aidl.exe from the currently stable one 23.1 - voila the "Invalid argument" error is gone :)

Rover Wanderer
  • 422
  • 3
  • 8
0

Firstly,the most important step is that you need to get more detail information about the error.

You can use one of the the following Gradle commands to get more details.

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

I have met the similar situation with the environment:

macOS 10.14.2
Android Studio 3.3

The more detail information is:

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

So the most important detail information is after 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

Finally,I found that there is somethings wrong with my AIDL file location.

ifeegoo
  • 7,054
  • 3
  • 33
  • 38