简体   繁体   中英

react-native-audio-recorder-player error Plugin with id "kotlin-android" not found. compileSdkVersion is not specified

A problem occurred evaluating project ':react-native-audio-recorder-player'.

Plugin with id 'kotlin-android' not found. To Reproduce: I just updated react-native-audio-recorder-player from 3.0.11 to 3.3.3

Expected behavior: Build project successfully.

Environment:

OS: macOS OS version: 10.15.4 react-native version: 0.67.1 react-native-audio-recorder-player version: 3.3.3

The solution for this

goto node_modules > react-native-audio-rcorder-player > android > build.gradle

add this line inside buildscript

dependencies { classpath 'com.android.tools.build:gradle:4.2.2' classpath "org.jetbrains.kotlin:kotlin-gradle- plugin:$kotlinVersion" }

the standard way for resolving this error is adding below configuration to android/build.gradle of your RN project to enable kotlin . (as library post install steps states)

buildscript {
  ext {
      buildToolsVersion = "29.0.3"
+     // Note: Below change is necessary for pause / resume audio feature. Not for Kotlin.
+     minSdkVersion = 24
      compileSdkVersion = 29
      targetSdkVersion = 29
+     kotlinVersion = '1.5.0'

      ndkVersion = "20.1.5948944"
  }
  repositories {
      google()
      jcenter()
  }
  dependencies {
      classpath("com.android.tools.build:gradle:4.1.0")
+     classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
  }
...

I also added below code to app/build.gradle file of my RN project for resolving error Invoke-customs are only supported starting with android 0 --min-api 26

android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

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