The plugin `flutter_2d_amap` doesn't have a main class defined
flutter pub get
Resolving dependencies...
Downloading packages... (1.5s)
_fe_analyzer_shared 91.0.0 (92.0.0 available)
analyzer 8.4.1 (9.0.0 available)
characters 1.4.0 (1.4.1 available)
device_info_plus 11.5.0 (12.3.0 available)
image_picker 1.2.0 (1.2.1 available)
js 0.6.7 (0.7.2 available)
matcher 0.12.17 (0.12.18 available)
material_color_utilities 0.11.1 (0.13.0 available)
! scrollable_positioned_list 0.3.8 (overridden)
test 1.26.3 (1.28.0 available)
test_api 0.7.7 (0.7.8 available)
test_core 0.6.12 (0.6.14 available)
url_launcher 6.3.0 (6.3.2 available)
url_strategy 0.3.0 (discontinued)
vibration 3.1.3 (3.1.4 available)
Got dependencies!
1 package is discontinued.
13 packages have newer versions incompatible with dependency constraints.
Try flutter pub outdated for more information.
The plugin flutter_2d_amap doesn't have a main class defined in
C:\Users\R11066\AppData\Local\Pub\Cache\git\flutter_2d_amap-2f9657e488c604ad6dffa0c93aa9f2cadc7b0de2\android\src\main\java\com\weilu\flutter\flutter_2d_amap\Flutter2dAmapPlugin.java or
C:\Users\R11066\AppData\Local\Pub\Cache\git\flutter_2d_amap-2f9657e488c604ad6dffa0c93aa9f2cadc7b0de2\android\src\main\kotlin\com\weilu\flutter\flutter_2d_amap\Flutter2dAmapPlugin.kt. This is likely to due to an incorrect androidPackage: com.weilu.flutter.flutter_2d_amap or mainClass entry in the plugin's pubspec.yaml.
If you are the author of this plugin, fix the androidPackage entry or move the main class to any of locations used
above. Otherwise, please contact the author of this plugin and consider using a different plugin in the meanwhile.
@simplezhli 请问这是什么问题,本地需要先安装 Android SDK 吗?
先执行flutter doctor 确保没有问题。如果你要运行Android,肯定要配置Android相关环境。如果还有问题,发一下你的flutter doctor 结果。
先执行
flutter doctor确保没有问题。如果你要运行Android,肯定要配置Android相关环境。如果还有问题,发一下你的flutter doctor结果。
D:\flutter\flutter_deer>flutter build apk
The plugin flutter_2d_amap doesn't have a main class defined in
C:\Users\R11066\AppData\Local\Pub\Cache\git\flutter_2d_amap-2f9657e488c604ad6dffa0c93aa9f2cadc7b0de2\android\src\main\java\com\weilu\flutter\flutter_2d_amap\Flutter2dAmapPlugin.java or
C:\Users\R11066\AppData\Local\Pub\Cache\git\flutter_2d_amap-2f9657e488c604ad6dffa0c93aa9f2cadc7b0de2\android\src\main\kotlin\com\weilu\flutter\flutter_2d_amap\Flutter2dAmapPlugin.kt. This is likely to due to an incorrect androidPackage: com.weilu.flutter.flutter_2d_amap or mainClass entry in the plugin's pubspec.yaml.
If you are the author of this plugin, fix the androidPackage entry or move the main class to any of locations used
above. Otherwise, please contact the author of this plugin and consider using a different plugin in the meanwhile.
D:\flutter\flutter_deer>flutter doctor Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 3.38.3, on Microsoft Windows [版本 10.0.19045.5679], locale zh-CN) [√] Windows Version (10 专业版 64 位, 22H2, 2009) [√] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [√] Chrome - develop for the web [X] Visual Studio - develop Windows apps X Visual Studio not installed; this is necessary to develop Windows apps. Download at https://visualstudio.microsoft.com/downloads/. Please install the "Desktop development with C++" workload, including all of its default components [√] Connected device (3 available) [√] Network resources
! Doctor found issues in 1 category.
我不需要构建桌面应用,没安装 Visual Studio 不影响吧
先试着把这个C:\Users\R11066\AppData\Local\Pub\Cache\git\flutter_2d_amap-2f9657e488c604ad6dffa0c93aa9f2cadc7b0de2文件删除,重新flutter pub get。怀疑是本地缓存的源码可能不完整,报错中提到的androidPackage和代码入口都是对的。