我正在尝试从 url 播放视频。我正在使用 video_player 包。但是当我尝试运行该项目时,构建失败并显示如下错误消息:
C:\flutter\.pub-cache\hosted\pub.dartlang.org\video_player-1.0.1\android\src\main\java\io\flutter\plugins\videoplayer\VideoPlayerPlugin.java:10: error: cannot find symbol
import io.flutter.FlutterInjector;
^
symbol: class FlutterInjector
location: package io.flutter
C:\flutter\.pub-cache\hosted\pub.dartlang.org\video_player-1.0.1\android\src\main\java\io\flutter\plugins\videoplayer\VideoPlayerPlugin.java:77: error: cannot find symbol
final FlutterInjector injector = FlutterInjector.instance();
^
symbol: class FlutterInjector
location: class VideoPlayerPlugin
C:\flutter\.pub-cache\hosted\pub.dartlang.org\video_player-1.0.1\android\src\main\java\io\flutter\plugins\videoplayer\VideoPlayerPlugin.java:77: error: cannot find symbol
final FlutterInjector injector = FlutterInjector.instance();
^
symbol: variable FlutterInjector
location: class VideoPlayerPlugin
3 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':video_player:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
答案 0 :(得分:1)
首先检查你的flutter频道,看看这个包是否支持这个频道。确保您处于稳定频道。 其次,将软件包更新到最新版本。 第三,做flutter clean,在终端输入(最好不要使用android studio工具)