Home > Mobile >  react-native-audio-recorder-player error Plugin with id "kotlin-android" not found. compil
react-native-audio-recorder-player error Plugin with id "kotlin-android" not found. compil

Time:01-29

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

CodePudding user response:

The solution for this

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

add this line inside buildscript dependencies

    ` classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"`

CodePudding user response:

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
    }
}
  •  Tags:  
  • Related