无法将Kotlin android扩展与Kotlin/native一起使用

无法将Kotlin android扩展与Kotlin/native一起使用,android,kotlin,kotlin-android-extensions,kotlin-native,Android,Kotlin,Kotlin Android Extensions,Kotlin Native,我想构建一个多平台的Kotlin模块,它可以与ios和android一起工作。但是当我使用 apply plugin: 'kotlin-platform-android' 我无法再解析导入中的kotlinx 这是我的androidbuild.gradle apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply pl

我想构建一个多平台的
Kotlin
模块,它可以与
ios
和android一起工作。但是当我使用

apply plugin: 'kotlin-platform-android'
我无法再解析导入中的kotlinx

这是我的androidbuild.gradle

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-platform-android'

android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.phonepe.mykotlinnativesample"
    minSdkVersion 15
    targetSdkVersion 28
    versionCode 2
    versionName "2.0"
    testInstrumentationRunner     "android.support.test.runner.AndroidJUnitRunner"

}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

def butterknife_version = '8.8.1'

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
kapt 'com.jakewharton:butterknife:8.8.1'
kapt 'com.jakewharton:butterknife-compiler:8.8.1'
implementation "com.jakewharton:butterknife:$butterknife_version"
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.google.android.material:material:1.0.0-alpha3'
expectedBy project(":common")
}
apply plugin: 'konan'
apply plugin: 'kotlin-platform-common'
repositories {
    mavenCentral()
}

dependencies {
compile 'org.jetbrains.kotlin:kotlin-stdlib'
compile "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version"
}
konan.targets = ['iphone', 'iphone_sim']
def frameworkName = 'KotlinHello'
konanArtifacts {
framework(frameworkName)
}
task lipo(type: Exec, dependsOn: 'build') {
def frameworks = files(
            "$buildDir/konan/bin/iphone/${frameworkName}.framework/$frameworkName",
        "$buildDir/konan/bin/iphone_sim/${frameworkName}.framework/$frameworkName"
)
def output = file("$buildDir/konan/bin/iphone_universal/${frameworkName}.framework/$frameworkName")
inputs.files frameworks
outputs.file output
executable = 'lipo'
args = frameworks.files
args += ['-create', '-output', output]
}
task copyFramework(type: Copy, dependsOn: lipo) {
from("$buildDir/konan/bin/iphone") {
    include '*/Headers/*'
    include '*/Modules/*'
    include '*/Info.plist'
}
from "$buildDir/konan/bin/iphone_universal"
into "${rootProject.rootDir}/ios"
}
这是我常见的版本。gradle

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-platform-android'

android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.phonepe.mykotlinnativesample"
    minSdkVersion 15
    targetSdkVersion 28
    versionCode 2
    versionName "2.0"
    testInstrumentationRunner     "android.support.test.runner.AndroidJUnitRunner"

}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

def butterknife_version = '8.8.1'

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
kapt 'com.jakewharton:butterknife:8.8.1'
kapt 'com.jakewharton:butterknife-compiler:8.8.1'
implementation "com.jakewharton:butterknife:$butterknife_version"
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.google.android.material:material:1.0.0-alpha3'
expectedBy project(":common")
}
apply plugin: 'konan'
apply plugin: 'kotlin-platform-common'
repositories {
    mavenCentral()
}

dependencies {
compile 'org.jetbrains.kotlin:kotlin-stdlib'
compile "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version"
}
konan.targets = ['iphone', 'iphone_sim']
def frameworkName = 'KotlinHello'
konanArtifacts {
framework(frameworkName)
}
task lipo(type: Exec, dependsOn: 'build') {
def frameworks = files(
            "$buildDir/konan/bin/iphone/${frameworkName}.framework/$frameworkName",
        "$buildDir/konan/bin/iphone_sim/${frameworkName}.framework/$frameworkName"
)
def output = file("$buildDir/konan/bin/iphone_universal/${frameworkName}.framework/$frameworkName")
inputs.files frameworks
outputs.file output
executable = 'lipo'
args = frameworks.files
args += ['-create', '-output', output]
}
task copyFramework(type: Copy, dependsOn: lipo) {
from("$buildDir/konan/bin/iphone") {
    include '*/Headers/*'
    include '*/Modules/*'
    include '*/Info.plist'
}
from "$buildDir/konan/bin/iphone_universal"
into "${rootProject.rootDir}/ios"
}

Kotlin/Native目前不支持kapt或任何其他kotlinx库。我们可以在android平台的应用程序中使用kapt,但不能在主要的通用模块中使用