【发布时间】:2020-10-24 14:18:52
【问题描述】:
环境详情 Windows + VS 代码 Flutter 1.17.5 • 通道稳定 • https://github.com/flutter/flutter.git 框架 • 修订版 8af6b2f038(3 天前) • 2020-06-30 12:53:55 -0700 引擎 • 修订版 ee76268252 工具• Dart 2.8.4
来自调试控制台的错误
E:\apps\flutterCode\android\app\src\main\java\com\example\testApp\MainActivity.java:3: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
^
E:\apps\flutterCode\android\app\src\main\java\com\example\TestApp\MainActivity.java:10: error: cannot find symbol
public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
^
symbol: class NonNull
location: class MainActivity
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app: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 10s
Exception: Gradle task assembleDebug failed with exit code 1
【问题讨论】:
-
我找到了一个解决方法,新建一个flutter项目,复制android文件夹然后替换旧项目中的android文件夹。