Gradle构建失败 任务 ':webview_flutter:compileDebugJavaWithJavac' 执行失败

3

我的Flutter应用程序甚至没有webview_flutter插件,但正在显示错误。Gradle构建失败。首先它告诉我将minSDkVersion设置为19。我做到了,但仍然出现错误。我之前有一个完全相同的代码和插件的不同项目正在运行相同的应用程序,但我不明白发生了什么。请帮帮我。

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
Note: C:\flutter\.pub-cache\hosted\pub.dartlang.org\thumbnails- 
1.0.1\android\src\main\java\com\asapjay\thumbnails\ThumbnailsPlugin.java uses or overrides a 
deprecated API.
Note: Recompile with -Xlint:deprecation for details.
C:\flutter\.pub-cache\hosted\pub.dartlang.org\webview_flutter- 
2.0.6\android\src\main\java\io\flutter\plugins\webviewflutter\InputAwareWebView.java:31: error: 
cannot find symbol
private ThreadedInputConnectionProxyAdapterView proxyAdapterView;
      ^
symbol:   class ThreadedInputConnectionProxyAdapterView
location: class InputAwareWebView
C:\flutter\.pub-cache\hosted\pub.dartlang.org\webview_flutter- 
2.0.6\android\src\main\java\io\flutter\plugins\webviewflutter\InputAwareWebView.java:112: error: 
cannot find symbol
    new ThreadedInputConnectionProxyAdapterView(
        ^
symbol:   class ThreadedInputConnectionProxyAdapterView
location: class InputAwareWebView
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':webview_flutter: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

BUILD FAILED in 44s
Exception: Gradle task assembleDebug failed with exit code 1

1
我也遇到了同样的问题... - Dheeraj Jaiswal
你在构建什么? - Yash Jha
1
我的一个客户提供了一个旧的Flutter项目,所以在运行应用程序时我遇到了相同的问题。 - Dheeraj Jaiswal
2个回答

2

ThreadedInputConnectionProxyAdapterView的扩展名错误,应该手动更改为.java作为临时解决方案。

或者

我暂时将webview_flutter降级到2.0.4。(如果这种解决方法不起作用,那么您需要检查pubsepc.lock文件中的webview_flutter,因为某些其他依赖项可能会扩展webview_flutter,所以这个包将出现在pubsepc.lock文件中,然后您只需要从该文件中降级webview_flutter即可)

享受!


1
谢谢!请注意,此文件存在于您的Flutter SDK文件夹(在.pub-cache中)和appdata\local\pub\cache中。我必须在两个地方修复它以避免错误。 - abh

0
这是由于 webview_flutter 包版本问题引起的。我已经降级了该版本并且它可以工作了。请前往 pubspec.yaml 并将版本降级到 2.0.14。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接