簡體   English   中英

配置 kotlin-gradle-plugin、kotlin-android 和 kotlin-android-extensions 后,React 本機 android 構建失敗

[英]React native android build is failing after configured kotlin-gradle-plugin, kotlin-android and kotlin-android-extensions

我在我的 React Native 項目中實現了 AWS chime。 正如 這里提到的 我必須將以下配置添加到我的項目中。

build.gradle文件更改

buildscript {
    ext.kotlin_version = '1.3.71'
    ...
    dependencies {
        ...
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

app/build.gradle文件更改

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

dependencies {
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3'
    implementation 'androidx.core:core-ktx:1.1.0'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

當我配置了這些變化后yarn android (編譯)我的構建與失敗.kt文件錯誤node_modules

e: /projects/rndemo/node_modules/expo/android/src/main/java/expo/modules/ExpoModulesPackage.kt: (27, 9): Type inference failed: Not enough information to infer parameter T in fun <T> emptyList(): List<T>
Please specify it explicitly.

e: /projects/rndemo/node_modules/expo/android/src/main/java/expo/modules/ReactActivityDelegateWrapper.kt: (48, 12): Type inference failed: fun <T, A> invokeDelegateMethod(name: String, argTypes: Array<Class<*>>, args: Array<A>): T
cannot be applied to
(String,Array<Class<*>>,Array<String?>)

如果沒有上述配置更改,應用程序工作正常。

這是什么原因?

有沒有辦法跳過使用指定 kotlin 版本編譯的節點模塊?

通過將 kotlin 版本更新為ext.kotlin_version = '1.5.31'解決了該問題

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM