android N无法在app billing AIDL中编译

Bri*_*vdb 10 android aidl in-app-billing android-studio android-7.0-nougat

我只是想在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
Run Code Online (Sandbox Code Playgroud)

我已经尝试使用最新的IInAppBillingService.aidl,但我仍然得到相同的错误.当我删除I​​InAppBillingService.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
}
Run Code Online (Sandbox Code Playgroud)

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

src/main/aidl/com/android/vending/billing
Run Code Online (Sandbox Code Playgroud)

如何解决这个问题?

Dha*_*mar 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
  }
}
Run Code Online (Sandbox Code Playgroud)