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

时间:2021-05-18 15:14:06

标签: flutter dart gradle

我的 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 个答案:

答案 0 :(得分:2)

ThreadedInputConnectionProxyAdapterView 有错误的扩展名 .jav 您可以手动将其更改为 .java 作为临时修复。

我暂时将 webview_flutter 降级回 2.0.4。 (在降级 webview_flutter 后,如果此解决方案不起作用,则您需要检查 pubsepc.lock 文件中的 webview_flutter,因为其他一些依赖项可能会扩展 webview_flutter,因此该包将在 pubsepc.lock 文件中可见,那么您也只需要从该文件中降级 webview_flutter )

享受吧!