1

Flutter 2.2.3 •

channel stable • https://github.com/flutter/flutter.git

Framework • revision f4abaa0735 (4 months ago) • 2021-07-01 12:46:11 -0700

Engine • revision 241c87ad80 Tools • Dart 2.13.4

  • /flutter/.pub-cache/hosted/pub.dartlang.org/geolocator_android-2.1.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 /Users/sonusaini/Documents/application/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator_android-2.1.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. * 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 21s Exception: Gradle task assembleDebug failed with exit code 1

2 Answers 2

0

If you don't intend to suport Android 12, just set your geolocator to 7.6.2

pubspec.yaml

  geolocator: 7.6.2

Have a look into this issue: #866


If you do intend to support Andorid 12:

First update compile SDK version to 31 and you must update your JDK version to 11

android\app\build.gradle

compileSdkVersion 31

more details here: #868

it may work but you will receive a lot of mappings warnings, to solve it you have to update your Gradle version, to do it I use Android Studio:

Open you flutter project on Android Studio, then
Tools > Flutter > Open Android Module in Android Studio then select new window.
it will sync Gradle and will ask if you want to update it!

Sign up to request clarification or add additional context in comments.

Comments

0

If u are not targeting Android 12 add this to pubspec.yaml

geolocator: 7.6.2

Note: please do not use the caret ^ symbol

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.