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 lib\main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...
e: C:\Users\Da2ny\AppData\Local\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: C:\Users\Da2ny\AppData\Local\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 6s
Here my flutter doctor:
C:\lib\flutter\bin\flutter.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:\lib\flutter
• 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:\lib\flutter-android
• Platform android-32, build-tools 32.0.0
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• 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 Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.4)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• 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 Files\Android\Android 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 Files\Android\Android 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:\Users\Da2ny\AppData\Local\Programs\Microsoft 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 ?
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
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
I fixed it:
Updating compileSdkVersion to 32 in Android->App->build.gradle
Adding android:exported="true" to <activity in android->app->src->main->AndroidManifest.xml
Doing 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
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Reinstalling the last version of Flutter - Stable Channel
Related
i'm going to learn flutter.
so i installed the latest version of flutter(Flutter 3.3.8) and make the path of that on windows.
then i installed the latest version of android studio(Android Studio Dolphin | 2021.3.1 Patch 1) and installed the flutter plugin and sdk and emulator of api 32 and 29 on it.
also i installed the java jdk and jre v8.
but when i try to run the defult app on emulator in recevied this error on terminal :
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:7.1.2.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.1.2/gradle-7.1.2.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.1.2/gradle-7.1.2.pom
Required by:
project :
and here it is the result of doctor command of flutter :
C:\Users\new>flutter doctor -v
[√] Flutter (Channel stable, 3.3.8, on Microsoft Windows [Version 10.0.18363.535], locale en-US)
• Flutter version 3.3.8 on channel stable at E:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 52b3dc25f6 (9 days ago), 2022-11-09 12:09:26 +0800
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at C:\Users\new\AppData\Local\Android\sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: E:\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[X] Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2021.3)
• Android Studio at E:\Android\Android 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.13+0-b1751.21-8125866)
[√] VS Code, 64-bit edition (version 1.71.2)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension can be installed from:
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (3 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.18363.535]
• Chrome (web) • chrome • web-javascript • Google Chrome 107.0.5304.107
[√] HTTP Host Availability
• All required HTTP hosts are available
I would be grateful if you could guide me in solving this problem.
thx to all!
build.gradle codes
Add google() to your repositories(buildscript and allprojects sections) of app level build.gradle file. The Android Gradle plugin is located there: your_project_folder/android/build.gradle
buildscript {
...
repositories {
google()
mavenCentral()
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
after some days and try many ways to solve this problem!
found the right solution :
proxy setting was my problem and config that with new proxy settings solve that problem!
thanks everyone.
solved!
After upgrading to Flutter 3.3.7, and running "flutter pub outdated && flutter pub upgrade" I tried to build my app as usual. But then this showed up. "A problem occurred evaluating project ':flutter_downloader'". I added a new issue in https://github.com/fluttercommunity/flutter_downloader/issues/748 as well. Any ideas what could possibly go wrong? Thanks in advance.
DEBUG CONSOLE RESULTS:
build type: release, signining with release config..
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
Where:
Build file '/Users/xx/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_downloader-1.9.0/android/build.gradle' line: 30
What went wrong:
A problem occurred evaluating project ':flutter_downloader'.
Failed to apply plugin class 'org.jlleitschuh.gradle.ktlint.KtlintBasePlugin'.
Current version of plugin supports minimal Gradle version: 6.8
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.
==============================================================================
2: Task failed with an exception.
Where:
Script '/Users/xx/development/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 474
What went wrong:
A problem occurred configuring project ':flutter_downloader'.
Failed to notify project evaluation listener.
Cannot invoke method substring() on null object
com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle
"
Flutter Doctor Results:
(Mac Book Air 13" M1 processor )
[✓] Flutter (Channel stable, 3.3.7, on macOS 12.6 21G115 darwin-arm, locale en-US)
• Flutter version 3.3.7 on channel stable at /Users/xx/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision e99c9c7cd9 (33 hours ago), 2022-11-01 16:59:00 -0700
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
• Android SDK at /Users/xx/Library/Android/sdk
• Platform android-33, build-tools 32.1.0-rc1
• ANDROID_HOME = /Users/xx/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14A400
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.3)
• Android Studio at /Applications/Android Studio.app/Contents
• 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.13+0-b1751.21-8125866)
[✓] VS Code (version 1.72.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.52.0
[✓] Connected device (3 available)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 12 (API 31) (emulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 12.6 21G115 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome 107.0.5304.87
[✓] HTTP Host Availability
• All required HTTP hosts are available
I followed this solution:
"Get a copy of the "\gradle"-folder from another working project (or create a new project)."
(from https://stackoverflow.com/a/70862628/16703736)
Changing the gradle-wrapper.properties to >6.8 fixed it.
I have an error in my build.gradle file (android/build.gradle) in my Flutter project. The App is running completely normal but this error is still not looking good to me.
Does anyone ever had this problem/error?
Here is my complete build.gradle file:
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.13'
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
flutter doctor -v Output:
[√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.22598.200], locale de-DE)
• Flutter version 3.0.5 at C:\Flutter\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f1875d570e (5 weeks ago), 2022-07-13 11:24:16 -0700
• Engine revision e85ea0e79c
• Dart version 2.17.6
• DevTools version 2.12.2
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\jjkla\AppData\Local\Android\sdk
• Platform android-31, build-tools 30.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 2020.3)
• Android Studio at C:\Program Files\Android\Android 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.10+0-b96-7249189)
[√] VS Code (version 1.70.1)
• VS Code at C:\Users\jjkla\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.46.0
[√] Connected device (2 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 104.0.5112.81
• Edge (web) • edge • web-javascript • Microsoft Edge 104.0.1293.54
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Same problem here, but in Linux and Visual Studio code.
With ./gradlew in android directory, the build failed due wrong Java version. Was Java 1.8, but must be at least 11. After that, ./gradlew built successfully.
After restart visual studio code, the error was gone.
open your android project in android studio
file > open > in your flutter project choose android file
then rebuild gradle, I have same problem and solved it like this.
You can do flutter clean and flutter pub get and then try to build again.
You can try to rebuild the build.gradle file.
Just follow these steps.
cd android
./gradlew clean
./gradlew build
You can also execute this command in one line.
./gradlew clean build
I'm facing an issue after run the Flutter Upgrade once again on existing one. When I try to run my app I confronted the error that has given below.
Error
[Fatal Error] x86_debug-1.0.0-bd539267b42051b0da3d16ffa8f48949dce8aa8f.pom:2:1: Content is not allowed in prolog.
[Fatal Error] flutter_embedding_debug-1.0.0-bd539267b42051b0da3d16ffa8f48949dce8aa8f.pom:9:12: An invalid XML character (Unicode: 0x0) was found in the element content of the document.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not resolve io.flutter:x86_debug:1.0.0-bd539267b42051b0da3d16ffa8f48949dce8aa8f.
Required by:
project :app
> Could not resolve io.flutter:x86_debug:1.0.0-bd539267b42051b0da3d16ffa8f48949dce8aa8f.
> Could not parse POM https://storage.googleapis.com/download.flutter.io/io/flutter/x86_debug/1.0.0-bd539267b42051b0da3d16ffa8f48949dce8aa8f/x86_debug-1.0.0-bd539267b42051b0da3d16ffa8f48949dce8aa8f.pom
> Content is not allowed in prolog.
Could not resolve io.flutter:flutter_embedding_debug:1.0.0-bd539267b42051b0da3d16ffa8f48949dce8aa8f.
Required by:
project :app > project :video_player_android
project :app > project :wakelock
> Could not resolve io.flutter:flutter_embedding_debug:1.0.0-bd539267b42051b0da3d16ffa8f48949dce8aa8f.
> Could not parse POM https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-bd539267b42051b0da3d16ffa8f48949dce8aa8f/flutter_embedding_debug-1.0.0-bd539267b42051b0da3d16ffa8f48949dce8aa8f.pom
> An invalid XML character (Unicode: 0x0) was found in the element content of the document.
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 26s
Exception: Gradle task assembleDebug failed with exit code 1
I've tried every possible solution but couldn't find the right one.
Most tried solution
allprojects {
repositories {
......
maven {url "https://storage.googleapis.com/download.flutter.io"}
}
}
Reffernce: enter link description here
Flutter Doctor log
[√] Flutter (Channel stable, 2.10.3, on Microsoft Windows [Version 10.0.19041.1415], locale en-US)
• Flutter version 2.10.3 at C:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7e9793dee1 (11 days ago), 2022-03-02 11:23:12 -0600
• Engine revision bd539267b4
• Dart version 2.16.1
• DevTools version 2.9.2
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\User\AppData\Local\Android\Sdk
X cmdline-tools component is missing
Run path/to/sdkmanager --install "cmdline-tools;latest"
See https://developer.android.com/studio/command-line for more details.
X Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[X] Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 4.1)
• Android Studio at C:\Program Files\Android\Android 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 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.65.2)
• VS Code at C:\Users\User\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.22.0
[√] Connected device (5 available)
• Redmi Note 8 (mobile) • 13ab130b • android-arm64 • Android 10 (API 29)
• sdk gphone x86 arm (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19041.1415]
• Chrome (web) • chrome • web-javascript • Google Chrome 84.0.4147.125
• Edge (web) • edge • web-javascript • Microsoft Edge 84.0.522.59
[√] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 2 categories.
Note: Code run perfectly on Web version but issue arise when try to run on Emulator or physical device.
Any suggestion and solution on this issue would be appriciated.
Thanks.
I create a empty flutter application and I got this error when I run this in android emulator. I already installed java, AD (4.1),git but don't know what happens. If anyone has idea let me know. Thanks :)
error log
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to install the following SDK components:
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-29 Android SDK Platform 29
Install the missing components using the SDK manager in Android Studio.
* 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
flutter doctor full summary
PS F:\Flutter\flutter_application_1> flutter doctor -v [√] Flutter (Channel stable, 2.0.0, on Microsoft Windows [Version 10.0.19042.804], locale en-US)
• Flutter version 2.0.0 at C:\src\flutter
• Framework revision 60bd88df91 (16 hours ago), 2021-03-03 09:13:17 -0800
• Engine revision 40441def69
• Dart version 2.12.0
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\vaagm\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android 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 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.53.2)
• VS Code at C:\Users\vaagm\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.20.0
[√] Connected device (3 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 5.1.1 (API 22) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.190
• Edge (web) • edge • web-javascript • Microsoft Edge 88.0.705.81
• No issues found!
The solution is there in the error message.
you need to install following SDK components:
build-tools; 28.0.3 Android SDK Build-Tools 28.0.3
platforms; android-29 Android SDK Platform 29
Install the missing components using the SDK manager in Android Studio.
Go to File>settings>Appearance & Behaviour>System settings>Android SDK> And install the mentioned sdk build tools,platform.
After some searching, according to this question, you need to accept android licenses. Check this out and let us know your results :) Hope it will help