简体   繁体   中英

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

I implemented AWS chime into my react native project. As mentioned here I had to add below configs into my project.

build.gradle file changes

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

app/build.gradle file changes

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"
}

When I configured these changes and after yarn android (build) my build is failing with .kt file error in 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?>)

Without above configuration changes application works fine.

What is the reason for this ?

Is there a way to skip node modules being compiled with specified kotlin version ?

通过将 kotlin 版本更新为ext.kotlin_version = '1.5.31'解决了该问题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM