'Execution failed for task ':location:compileDebugKotlin'

Execution failed for task ':location:compileDebugKotlin'.

Running Gradle task 'assembleDebug'... e: /Users/apple/.pub-cache/hosted/pub.dartlang.org/location-4.3.0/android/src/main/java/com/lyokone/location/FlutterLocationService.kt: (124, 1): Class 'FlutterLocationService' is not abstract and does not implement abstract member public abstract fun onRequestPermissionsResult(p0: Int, p1: Array<(out) String!>, p2: IntArray): Boolean defined in io.flutter.plugin.common.PluginRegistry.RequestPermissionsResultListener e: /Users/apple/.pub-cache/hosted/pub.dartlang.org/location-4.3.0/android/src/main/java/com/lyokone/location/FlutterLocationService.kt: (258, 5): 'onRequestPermissionsResult' overrides nothing

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':location:compileDebugKotlin'.

Compilation error. See log for more 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 4s Exception: Gradle task assembleDebug failed with exit code 1



Solution 1:[1]

I think this is due to version mismatch with the package. In my case, it was solved by changing the package version to latest version.

- location: ^4.3.0
+ location: ^4.4.0

Solution 2:[2]

Just make sure that you have added location permissions in AndroidManifest file. if not, add these permissions in main -> AndroidManifest.xml ,

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

Solution 3:[3]

In my case I did this: In command line

flutter clean && flutter pub get

then, inside pubspec.yaml

upgrade speech_to_text library from speech_to_text: ^5.4.0 to speech_to_text: ^5.5.0

Finally, it worked for me

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Zeyar Paing
Solution 2
Solution 3 M E S A B O