【发布时间】:2021-11-27 22:12:43
【问题描述】:
使用Geolocator pluggin 编译项目时出现当前错误:
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\geolocator_android-2.0.0\android\src\main\java\com\baseflow\geolocator\location\LocationMapper.java:29: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
^
symbol: variable S
location: class VERSION_CODES
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\geolocator_android-2.0.0\android\src\main\java\com\baseflow\geolocator\location\LocationMapper.java:30: error: cannot find symbol
position.put("is_mocked", location.isMock());
^
symbol: method isMock()
location: variable location of type Location
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':geolocator_android:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
我已经创建了另一个项目来测试是否会出现错误,并且在导入包时也会出现错误。我遵循了 gradle.properties 配置 并将 compileSdkVersion 设置为 30 并检查了 Flutter Doctor,一切正常,但错误仍然存在。有谁知道这可能是什么原因造成的?
【问题讨论】:
-
我在添加 2 天前工作的地理定位器时也遇到了同样的错误!!它适用于旧版本的地理定位器(6.2.1)
标签: flutter android-studio flutter-dependencies dart-pub