I am trying to build my app but I have encountered a problem that I do not success to resolve. I’ve tried many stackoverflow solution without any success (like this one Execution failed for task ':location:compileDebugKotlin').
Here the building error:
Launching libmain.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...
e: C:UsersDa2nyAppDataLocalPubCachehostedpub.dartlang.orglocation-4.3.0androidsrcmainjavacomlyokonelocationFlutterLocationService.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: C:UsersDa2nyAppDataLocalPubCachehostedpub.dartlang.orglocation-4.3.0androidsrcmainjavacomlyokonelocationFlutterLocationService.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 6s
Here my flutter doctor:
C:libflutterbinflutter.bat doctor --verbose
[√] Flutter (Channel beta, 2.13.0-0.1.pre, on Microsoft Windows [Version 10.0.22000.613], locale fr-FR)
• Flutter version 2.13.0-0.1.pre at C:libflutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 13a2fb10b8 (5 days ago), 2022-04-12 15:34:25 -0500
• Engine revision 499984f99c
• Dart version 2.17.0 (build 2.17.0-266.1.beta)
• DevTools version 2.12.1
[√] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
• Android SDK at C:libflutter-android
• Platform android-32, build-tools 32.0.0
• Java binary at: C:Program FilesAndroidAndroid Studio1jrebinjava
• Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:Program FilesGoogleChromeApplicationchrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.4)
• Visual Studio at C:Program FilesMicrosoft Visual Studio2022Community
• Visual Studio Community 2022 version 17.1.32407.343
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2020.3)
• Android Studio at C:Program FilesAndroidAndroid Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
[√] Android Studio (version 2021.1)
• Android Studio at C:Program FilesAndroidAndroid Studio1
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
[√] VS Code (version 1.66.2)
• VS Code at C:UsersDa2nyAppDataLocalProgramsMicrosoft VS Code
• Flutter extension can be installed from:
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (4 available)
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 12 (API 32) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22000.613]
• Chrome (web) • chrome • web-javascript • Google Chrome 100.0.4896.88
• Edge (web) • edge • web-javascript • Microsoft Edge 100.0.1185.29
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Process finished with exit code 0
My kotlin version: ext.kotlin_version = '1.6.10'
The added perms:
<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"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Could you please help me ?
2
Answers
I fixed it:
Updating
compileSdkVersion
to 32 in Android->App->build.gradleAdding
android:exported="true"
to<activity
in android->app->src->main->AndroidManifest.xmlDoing the modification of @AHMAD_AR
andoid->geadle->wrapper-> in file grdle-wrapper.properites edit last line
distributionUrl=https://services.gradle.org/distributions/gradle-7.4.1-all.zip
then upgrade kotlin version in build.gradle
Reinstalling the last version of Flutter - Stable Channel
if you recently upgrade your flutter you need to upgrade gradle and kotllin version in your app
download latest version of gradle and include it in your project like this:
in the following folder : andoid->geadle->wrapper-> in file grdle-wrapper.properites edit last line
distributionUrl=https://services.gradle.org/distributions/gradle-7.4.1-all.zip
then upgrade kotlin version in build.gradle
}