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

Android Studio Lady Bug更新后添加video_player插件编译失败求助

解决video_player插件编译错误的方案

针对你遇到的Execution failed for task ':video_player_android:compileDebugJavaWithJavac'错误,可按以下步骤排查解决:

  • 修正applicationId语法错误
    你的build.gradle中defaultConfig下的applicationId = "com.example.//"是无效格式,必须改为合法的包名,比如和namespace保持一致:

    applicationId = "com.example.meditation_app"
    
  • 确认JDK配置为Android Studio自带版本
    打开Android Studio的File → Project Structure → SDK Location,确保JDK location指向Android Studio内置的JDK(Lady Bug版本默认是JDK17,与Gradle8.3兼容),路径示例:

    • Mac:/Applications/Android Studio.app/Contents/jbr/Contents/Home
    • Windows:C:\Program Files\Android\Android Studio\jbr
  • 强制指定JDK路径到gradle.properties
    在项目根目录的android/gradle.properties文件中添加以下配置(替换为你的实际JDK路径):

    org.gradle.java.home=/Applications/Android Studio.app/Contents/jbr/Contents/Home
    android.jdk.home=/Applications/Android Studio.app/Contents/jbr/Contents/Home
    
  • 升级video_player插件版本
    确保pubspec.yaml中的video_player版本与当前Flutter版本兼容,执行命令升级至最新兼容版本:

    flutter pub upgrade video_player
    
  • 清理缓存并重新构建
    执行以下命令彻底清理缓存后重新构建项目:

    flutter clean
    cd android
    ./gradlew clean
    ./gradlew build --refresh-dependencies
    cd ..
    flutter pub get
    flutter run
    

内容的提问来源于stack exchange,提问作者Ali Esmkhani

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.17 06:24:53