You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter集成Zoom Video SDK时Release构建遇Kotlin版本不兼容问题

Flutter集成Zoom Video SDK构建Release包时Kotlin版本兼容问题解决方案

问题概述

使用Flutter 3.7.7开发应用,集成Zoom Video SDK后,USB调试运行正常,但执行flutter build apk --release构建Release版本时,出现Kotlin版本不兼容错误(依赖模块编译用Kotlin 1.8.0,项目期望1.6.0),同时伴随API废弃、不安全操作提示。已尝试./gradlew clean和../gradlew assembleRelease,问题未解决。

报错信息

Note: C:\Users\F�bio Brasileiro\AppData\Local\Pub\Cache\hosted\pub.dev\cloud_firestore-4.8.0\android\src\main\java\io\flutter\plugins\firebase\firestore\FlutterFirebaseFirestoreMessageCodec.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\F�bio Brasileiro\AppData\Local\Pub\Cache\hosted\pub.dev\cloud_firestore-4.8.0\android\src\main\java\io\flutter\plugins\firebase\firestore\FlutterFirebaseFirestoreMessageCodec.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: C:\Users\F�bio Brasileiro\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_zoom_videosdk-1.7.0\android\src\main\java\com\flutterzoom\videosdk\FlutterZoomVideoSdkPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
e: C:/Users/F�bio Brasileiro/.gradle/caches/transforms-3/a2a101baaed768f358d4d8f74655776a/transformed/jetified-activity-1.7.0/jars/classes.jar!/META-INF/activity_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 
1.8.0, expected version is 1.6.0.
e: C:/Users/F�bio Brasileiro/.gradle/caches/transforms-3/b365cbbdc580e3f264ee929243b93252/transformed/lifecycle-livedata-2.6.1/jars/classes.jar!/META-INF/lifecycle-livedata_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: C:/Users/F�bio Brasileiro/.gradle/caches/transforms-3/4817204ab7acc54a5f2c041737b3ebbd/transformed/lifecycle-viewmodel-2.6.1/jars/classes.jar!/META-INF/lifecycle-viewmodel_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: C:/Users/F�bio Brasileiro/.gradle/caches/transforms-3/fb13d994a9c57675c3797fdb5edd3dc7/transformed/lifecycle-livedata-core-2.6.1/jars/classes.jar!/META-INF/lifecycle-livedata-core_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: C:/Users/F�bio Brasileiro/.gradle/caches/transforms-3/7c1fedf36a262d80afd033982dc78c54/transformed/jetified-lifecycle-viewmodel-savedstate-2.6.1/jars/classes.jar!/META-INF/lifecycle-viewmodel-savedstate_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: C:/Users/F�bio Brasileiro/.gradle/caches/transforms-3/f7cdfb73eaf400e8b2c346bb8e6d73ec/transformed/jetified-core-ktx-1.10.1/jars/classes.jar!/META-INF/core-ktx_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: C:/Users/F�bio Brasileiro/.gradle/caches/transforms-3/9c9ab1a476c120097a79d748cec7161f/transformed/core-1.10.1/jars/classes.jar!/META-INF/core_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected 
version is 1.6.0.
e: C:/Users/F�bio Brasileiro/.gradle/caches/transforms-3/ad9f1a2743e3eaf4aa449a5b2d8828b3/transformed/lifecycle-runtime-2.6.1/jars/classes.jar!/META-INF/lifecycle-runtime_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: C:/Users/F�bio Brasileiro/.gradle/caches/modules-2/files-2.1/androidx.lifecycle/lifecycle-common/2.6.1/10f354fdb64868baecd67128560c5a0d6312c495/lifecycle-common-2.6.1.jar!/META-INF/lifecycle-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: C:/Users/F�bio Brasileiro/.gradle/caches/transforms-3/acc0a4ed60db051ae6d4cb2c458aa935/transformed/jetified-savedstate-1.2.1/jars/classes.jar!/META-INF/savedstate_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: C:/Users/F�bio Brasileiro/.gradle/caches/modules-2/files-2.1/androidx.annotation/annotation-jvm/1.6.0/a7257339a052df0f91433cf9651231bbb802b502/annotation-jvm-1.6.0.jar!/META-INF/annotation.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: C:/Users/F�bio Brasileiro/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.8.21/43d50ab85bc7587adfe3dda3dbe579e5f8d51265/kotlin-stdlib-1.8.21.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: C:/Users/F�bio Brasileiro/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.8.21/43d50ab85bc7587adfe3dda3dbe579e5f8d51265/kotlin-stdlib-1.8.21.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: C:/Users/F�bio Brasileiro/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.8.21/43d50ab85bc7587adfe3dda3dbe579e5f8d51265/kotlin-stdlib-1.8.21.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: C:/Users/F�bio Brasileiro/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.8.21/d749cd5ae25da36d06e5028785038e24f9d37976/kotlin-stdlib-common-1.8.21.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.

相关配置

pubspec.yaml

environment:
  sdk: '>=2.19.4 <3.0.0'

dependencies:
  flutter:
    sdk: flutter
  http: ^0.13.4
  flutter_secure_storage: ^8.0.0
  shared_preferences: ^2.1.1
  auth_buttons: ^3.0.0
  google_sign_in: ^6.0.2
  flutter_facebook_auth: ^5.0.11
  postgres: ^2.6.1
  bcrypt: ^1.1.3
  flutter_animate: ^4.1.1+1
  page_transition: ^2.0.9
  image_picker: ^0.8.7+5
  validatorless: ^1.2.3
  crypto: ^3.0.3
  google_nav_bar: ^5.0.6
  rxdart: ^0.27.7
  rflutter_alert: ^2.0.6
  get_it: ^7.6.0
  cloud_firestore: ^4.8.0
  google_mobile_ads: ^3.0.0
  firebase_core: ^2.13.1
  flutter_zoom_videosdk: 
  cupertino_icons: ^1.0.2
  flutter_hooks: ^0.18.6
  dart_jsonwebtoken: ^2.4.2
  shared_value: ^3.0.0
  events_emitter: ^0.5.2
  permission_handler: ^10.2.0
  google_fonts: ^3.0.0

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^2.0.0

gradle配置(android/app/build.gradle)

defaultConfig {
    minSdkVersion 24
    targetSdkVersion 33
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
    
}

buildTypes {
    release {
        // TODO: Add your own signing config for the release build.
        // Signing with the debug keys for now, so `flutter run --release` works.
        signingConfig signingConfigs.debug
         ext.kotlin_version = '1.4.32'
    }
}

flutter {
source '../..'
}

dependencies {
    implementation "us.zoom.videosdk:ZoomVideoSDK:0.0.1-beta"
    implementation "org.jetbrains.kotlin:kotlin-stdlib:1.8.21"
}

解决步骤

  1. 修正Kotlin版本配置位置
    打开项目根目录的android/build.gradle文件,将Kotlin版本配置移至buildscript块中,设置为与依赖匹配的1.8.21,示例:

    buildscript {
        ext.kotlin_version = '1.8.21'
        repositories {
            google()
            mavenCentral()
        }
        dependencies {
            classpath "com.android.tools.build:gradle:7.4.2"
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        }
    }
    

    同时删除android/app/build.gradle中buildTypes > release块内的ext.kotlin_version = '1.4.32'配置。

  2. 清理缓存并重新构建
    依次执行以下命令:

    flutter clean
    rm -rf android/.gradle
    flutter build apk --release
    
  3. 处理API废弃提示(可选)
    报错中的API废弃、不安全操作提示来自第三方依赖库,不影响构建成功。若要消除这些提示,可尝试将对应依赖包升级到最新兼容版本(如cloud_firestore、flutter_zoom_videosdk)。


内容的提问来源于stack exchange,提问作者Fábio brasileiro

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.19 11:12:00