I've been trying to run my Flutter app in VScode, but the following message appears:
Microsoft Windows [versão 10.0.19042.928]
(c) Microsoft Corporation. Todos os direitos reservados.
C:\projects\tests\fluttertest>flutter run
Launching lib\main.dart on Google Nexus 7 in debug mode...
Checking the license for package Android SDK Build-Tools 29.0.2 in C:\Users\sophi\AppData\Local\Android\sdk\licenses
Warning: License for package Android SDK Build-Tools 29.0.2 not accepted.
FAILURE: Build failed with an exception.
What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;29.0.2 Android SDK Build-Tools 29.0.2
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: C:\Users\sophi\AppData\Local\Android\sdk
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 16s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 17,2s
Exception: Gradle task assembleDebug failed with exit code 1
Also, when I run the flutter doctor in prompt it returns the following message
C:\src\flutter>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.0.5, on Microsoft Windows [versão 10.0.19042.928], locale pt-BR)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
X Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[√] Chrome - develop for the web
[√] Android Studio (version 4.1.0)
[√] VS Code (version 1.55.2)
[√] Connected device (3 available)
! Doctor found issues in 1 category.
C:\src\flutter>flutter doctor --android-license
Could not find an option named "android-license".
Run 'flutter -h' (or 'flutter <command> -h') for available flutter commands and options.
C:\src\flutter>flutter doctor --android-licenses
Warning: File C:\Users\sophi\.android\repositories.cfg could not be loaded.
7 of 7 SDK package licenses not accepted. 100% Computing updates...
Review licenses that have not been accepted (y/N)?
I've looked for my repositories.cfg file and it doesn't exist.
Go to SDK Manager and download android 10(if using android studio)
Make sure to download JDK Version 1.8
Run flutter doctor --android-licenses in the terminal
Run : Flutter doctor --andriod-licenses...
Then rund your code back
Related
I'm using M1 Mackbook air.
This is the result of installing Flutter-related extensions, Android Studio, and Android SDK and running Flutter Doctor.
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.10, on macOS 12.1 21C52 darwin-arm, locale
ko-KR)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✗] Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS
development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin
code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install see
https://guides.cocoapods.org/using/getting-started.html#installation for
instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.74.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
When executing Debug in the lib/main.dart file of the project created using flutter create, the following error appears. (the Android emulator specs are: Pixel 4, Android 10)
Launching lib/main.dart on Android SDK built for arm64 in debug mode... lib/main.dart:1
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':app:processDebugResources' (type 'LinkApplicationAndroidResourcesTask').
- In plugin 'com.android.internal.version-check' type 'com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask' property 'androidJarIn
put.androidJar' specifies file '/Users/gimmingi/Library/Android/sdk/platforms/android-31/android.jar' which doesn't exist.
Reason: An input file was expected to be present but it doesn't exist.
Possible solutions:
1. Make sure the file exists before the task is called.
2. Make sure that the task which produces the file is declared as an input.
Please refer to https://docs.gradle.org/7.4/userguide/validation_problems.html#input_file_does_not_exist for more details about this problem.
* 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 1s
Exception: Gradle task assemble Debug failed with exit code 1
Exited
Flutter default project should work in Android emulator.
Please check following items
As your build is trying to access android version 31 here android-31/android.jar. Check if android 31 is installed on your machine.
Check the compileSdkVersion and targetSdkVersion in your android/app/build.gradle file.
android {
...
compileSdkVersion 31
defaultConfig{
...
targetSdkVersion 31
...
}
}
Then you can either download the version 31 or change your sdk versions matching your installed sdk versions.
I'm using Ubuntu 20.04. I've reinstalled flutter and android studio a few times but I can't make the below error go away. I've also tried the commands flutter clean and gradlew clean and tried to change compileSdkVersion, minSdkVersion and targetSdkVersion.
Launching lib/main.dart on sdk gphone x86 in debug mode...
lib/main.dart:1
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
Could not create service of type UserHomeScopedCompileCaches using UserHomeScopeServices.createCompileCaches().
Unexpected lock protocol found in lock file. Expected 3, found 0.
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 36s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
When I run flutter doctor:
$: flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.1, on Ubuntu 20.04.4 LTS 5.13.0-44-generic,
locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version
32.1.0-rc1)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2021.2)
[✓] Android Studio
[✓] VS Code
[✓] Connected device (3 available)
[✓] HTTP Host Availability
• No issues found!
Java and javac:
$: java --version
openjdk 11.0.15 2022-04-19
OpenJDK Runtime Environment (build 11.0.15+10-Ubuntu-0ubuntu0.20.04.1)
OpenJDK 64-Bit Server VM (build 11.0.15+10-Ubuntu-0ubuntu0.20.04.1, mixed mode, sharing)
$: javac --version
javac 11.0.15
Disclaimer
i got this issue when i had android studio installed, i've been using android studio for a while before i got this issue. and i'm trying to uninstalling android studio to save some of my storage and manually install android emulator, still facing the same issue.
Description
my flutter app scan keystore in the wrong directory when try to run in android emulator, my app keystore located at
/Users/saidulumam/Documents/Projects/flutter/tome/android/~/Library/Android/Sdk/.android/debug.keystore
but it scans
/Users/saidulumam/Documents/Projects/flutter/tome/android/app/~/Library/Android/Sdk/.android/debug.keystore
Steps to Reproduce
go to project folder
type flutter create app_name in this case im using name tome
type cd tome
type flutter run
error
Screenshot
my directory
Logs
Error result :
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':app:packageDebug' (type 'PackageApplication').
> File '/Users/saidulumam/Documents/Projects/flutter/tome/android/app/~/Library/Android/Sdk/.android/debug.keystore' specified for property 'signingConfig.signingConfigData.storeFile' does not exist.
* 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 32s
Running Gradle task 'assembleDebug'... 33.9s
Exception: Gradle task assembleDebug failed with exit code 1
flutter doctor :
➜ tome flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.0, on macOS 12.2.1 21D62 darwin-arm, locale en-ID)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[!] Xcode - develop for iOS and macOS (Xcode 13.2.1)
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio (not installed)
[✓] VS Code (version 1.64.2)
[✓] Connected device (1 available)
[✓] HTTP Host Availability
! Doctor found issues in 3 categories.
try this command for specifying android sdk path to flutter :
flutter config --android-sdk <path-to-your-android-sdk-path>
I use flutter to make my cross platform app the experience is so smooth and it will work above my expectations but after update flutter to 2.8.1 it throw error like I mention below is that error occurs because of my code or there is flutter issue please let me know in comment
Here is my flutter doctor:-
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.8.1, on macOS 11.5.2 20G95 darwin-x64, locale
en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.2.2)
[✓] VS Code (version 1.59.1)
[✓] Connected device (2 available)
! Error: iPad is busy: Waiting for Device. Xcode will continue when iPad is
finished. (code -10)
! Error: iPhone 7 is not connected. Xcode will continue when iPhone 7 is
connected. (code -13)
• No issues found!
Here is eroor log:-
* What went wrong:
Execution failed for task ':app:stripDebugDebugSymbols'.
> No version of NDK matched the requested version 21.0.6113669. Versions available locally: 23.1.7779620
* 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 40s
Exception: Gradle task assembleDebug failed with exit code 1
I think your flutter version can't find ndk in your directory
here is some steps to set ndk in your project
download ndk side by side from sdk manager
Add Ndk path to your local.properties file in android-> local.properties Like this:-
ndk.dir=/Users/imac/Library/Android/sdk/ndk/23.1.7779620
Add ndkVersion in your app build.gradle file in android->app->build.gradle Like this:-
android {
compileSdkVersion 31
ndkVersion '23.1.7779620'
}
I am repeatedly getting this error again and again despite trying everything I could find online.
So far I have done these steps to solve this problem:
Removed android stuido, intelliJ and flutter and installed all of it again.
Reinstalled all SDK packages several times, i have attached image of all SDK packages for refernece.Please have a look.
Accepted all licenses.
C:\Users\Asus>flutter doctor --android-licenses
All SDK package licenses accepted.======] 100% Computing updates...
C:\Users\Asus>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.17.1, on Microsoft Windows [Version 10.0.18363.836], locale en-IN)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc4)
[√] Android Studio (version 3.6)
[√] Connected device (1 available)
• No issues found!
Tried using earlier version of flutter and tried again after upgrading it.
After doing all this I am still getting this error for all projects. Even the basic project which is pre-written when creating a new flutter project.
Launching lib\main.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...
Exception: Gradle task assembleDebug failed with exit code -1