【问题标题】:react-native-audio-recorder-player error Plugin with id "kotlin-android" not found. compileSdkVersion is not specifiedreact-native-audio-recorder-player 错误 未找到 ID 为“kotlin-android”的插件。 compileSdkVersion 未指定
【发布时间】:2022-01-22 18:53:21
【问题描述】:

评估项目 ':react-native-audio-recorder-player' 时出现问题。

未找到 ID 为“kotlin-android”的插件。 重现: 我刚刚将 react-native-audio-recorder-player 从 3.0.11 更新到 3.3.3

预期行为: 成功构建项目。

环境:

操作系统:macOS 操作系统版本:10.15.4 反应原生版本:0.67.1 react-native-audio-recorder-player 版本:3.3.3

【问题讨论】:

    标签: android react-native gradle


    【解决方案1】:

    解决此错误的标准方法是将以下配置添加到您的 RN 项目的 android/build.gradle 以启用 kotlin。 (如库后安装步骤所述)

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

    我还在我的 RN 项目的 app/build.gradle 文件中添加了以下代码,以解决错误 Invoke-customs are only supported starting with android 0 --min-api 26

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

    【讨论】:

      【解决方案2】:

      解决办法

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

      在 buildscript 依赖项中添加这一行(低于 build gradle 版本)

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-01-28
        • 2021-07-31
        • 1970-01-01
        • 2021-12-17
        • 2019-06-25
        • 1970-01-01
        • 2014-08-03
        • 1970-01-01
        相关资源
        最近更新 更多