Hello Guys How are you all? Hope You all are fine. When I was trying to run my flutter app and suddenly I get the following error in my stack track. Execution failed for task ‘:geolocator_android:compileDebugJavaWithJavac’ in a flutter. So today Here I come with all possible solutions for this error.
We are providing you all possible solutions to solve this error. let’s start this article without wasting your time.
How Execution failed for task ‘:geolocator_android:compileDebugJavaWithJavac’ in flutter Error Occurs ?
I am trying to run my code and I am facing following error.
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.
How to Solve Execution failed for task ‘:geolocator_android:compileDebugJavaWithJavac’ in flutter Error?
- Execution failed for task ':geolocator_android:compileDebugJavaWithJavac' in flutter
to Solve Execution failed for task ':geolocator_android:compileDebugJavaWithJavac' in flutter Error This error occurs in latest version of geolocator 7.7.0. To solve this error you just need to Change compileSDKVersion from 29 to 31. Just like this. And then just make sure This both should be in your gradle.properties. Second solution is This error occurs only in new version of geolocator so just downgrade geolocator to 6.2.1 and your error will be solved.
- How to Solve Execution failed for task ':geolocator_android:compileDebugJavaWithJavac' in flutter Error?
to Solve Execution failed for task ':geolocator_android:compileDebugJavaWithJavac' in flutter Error This error occurs in latest version of geolocator 7.7.0. To solve this error you just need to Change compileSDKVersion from 29 to 31. Just like this. And then just make sure This both should be in your gradle.properties. Second solution is This error occurs only in new version of geolocator so just downgrade geolocator to 6.2.1 and your error will be solved.
Solution 1: Change compileSDKVersion from 29 to 31
This error occurs in latest version of geolocator 7.7.0. To solve this error you just need to Change compileSDKVersion from 29 to 31. Just like this.
android {
compileSdkVersion 31
defaultConfig {
minSdkVersion 21
targetSdkVersion 29
}
}
And then just make sure This both should be in your gradle.properties.
android.useAndroidX=true
android.enableJetifier=true
Solution 2: Downgrade geolocator 6.2.1
This error occurs only in new version of geolocator so just downgrade geolocator to 6.2.1 and your error will be solved.
Summery
So, It’s All About This Error. I hope this tutorial helps you to Solve your error. Please Comment Below if You stucks anywhere with my code. And please comment below on which solution worked for you. Thank You.
Also Check Out Below Tutorials
- error: cannot find symbol position.put(“is_mocked”, location.isMock())
- PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)
- setState() or markNeedsBuild called during build A vertical renderflex overflowed
- Could not open settings generic class cache for settings file
- Exception in thread “main” java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema Flutter
thank you so much
Thanks a lot bro.. it worked
i am very happy resolving prosblim you are smart!!!! thank for
I have used compledisdk 29 to 31 and everything is good))))))))))))))))))))))))))))))))
Iam Bob iam so happy its worked…downgrading it my first time to hear it and to apply it in flutter….thanks man
Thank You For Commenting John.