Before anyone points me to this link I would like to mention, that I don't think these are directly related.
As one can see my flutter doctor -v command is error free:
➜ flutter git:(stable) flutter doctor -v
[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.15.3 19D76, locale en-US)
• Flutter version 1.12.13+hotfix.9 at /Users/johannes/.flutter-cli/flutter
• Framework revision f139b11009 (5 weeks ago), 2020-03-30 13:57:30 -0700
• Engine revision af51afceb8
• Dart version 2.7.2
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/johannes/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.4.1, Build version 11E503a
• CocoaPods version 1.8.4
[✓] Android Studio (version 3.6)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 45.1.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• No issues found!
Yet I to have the issue of a grayed out emulator device with the message Device not applicable for the “main.dart” configuration like this:
I can now only start the emulator using the dropdown menu <no device> like this:
Interestingly I am then actually able to run my app on the device, while the device is still grayed out:
Flutters hot-reloading feature seems to not work properly though.
I have already added the main folder to the project as suggested here and I also made sure to change NO SDK to ANDROID API PLATFORM as suggested in the same link. All dependencies in Project Structure > Modules are found by Android Studio. I cloned the Flutter SKD from the stable branch on GitHub.
Does anyone have an idea why my setup is behaving this way?
Close Android Studio and Run again as Administrator
It solved my problem:
1- Make sure Flutter plugin is installed in android studio, you can install the plugin from file > setting > plugin
2- choose flutter SDK path from File > setting> Language & Framework > flutter.
I have the same issue before.
Uninstall Flutter and Dart plugin from Android Studio then reinstall Flutter (Dart will be installed automatically)
Remove created emulators from AVD Manager and create new one
Try making new project, and set SDK version same as emulators API version or lower from File > Project Structure...
Hopefully worked for you.
Related
I've been trying to get my Flutter project to run after upgrading it to 2.10.4 and it's been a headache from the start. The project runs fine on a browser, but I'm having difficulty running on an Android emulator. I think I'm at the last hurdle, but I'm stumped right now. I'm receiving this error when running on VS Code:
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;30.0.2 Android SDK Build-Tools 30.0.2
The SDK directory is not writable (C:\Program Files (x86)\Android\android-sdk)
Here's my Flutter Doctor:
PS D:\Documents\Flutter_Projects\glance> flutter doctor -v
[√] Flutter (Channel stable, 2.10.4, on Microsoft Windows [Version 10.0.19043.1586], locale en-US)
• Flutter version 2.10.4 at D:\Programs\flutter_windows_v1.2.1-stable\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c860cba910 (3 weeks ago), 2022-03-25 00:23:12 -0500
• Engine revision 57d3bac3dd
• Dart version 2.16.2
• DevTools version 2.9.2
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Program Files (x86)\Android\android-sdk
• Platform android-31, build-tools 30.0.3
• ANDROID_HOME = C:\Users\reff1\AppData\Local\Android\Sdk
• ANDROID_SDK_ROOT = C:\Users\reff1\AppData\Local\Android\Sdk
• Java binary at: D:\AndroidStudio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
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 2021.1)
• Android Studio at D:\AndroidStudio
• 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 4.1)
• Android Studio at D:\Programs\AndroidStudio
• 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
X Unable to determine bundled Java version.
• Try updating or re-installing Android Studio.
[√] VS Code, 64-bit edition (version 1.50.1)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.17.0
[√] 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.19043.1586]
• Chrome (web) • chrome • web-javascript • Google Chrome 100.0.4896.88
• Edge (web) • edge • web-javascript • Microsoft Edge 99.0.1150.46
[√] HTTP Host Availability
• All required HTTP hosts are available
Here's the part that keeps getting me. I'm seeing I need to run flutter doctor --android-licenses and this is what I get:
PS D:\Documents\Flutter_Projects\glance> flutter doctor --android-licenses
Error: Could not find or load main class Files
I have no clue where to go from here. Any help would be greatly appreciated here. Thank you in advance.
It appears that you have two sets of Android Studio and Android SDK.
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Program Files (x86)\Android\android-sdk <--- 1
...
• ANDROID_HOME = C:\Users\reff1\AppData\Local\Android\Sdk <--- 2
[√] Android Studio (version 2021.1) <--- 1
• Android Studio at D:\AndroidStudio
...
[!] Android Studio (version 4.1) <--- 2
• Android Studio at D:\Programs\AndroidStudio
Android Studio version 4.1 is a bit older so I guess you installed it in the past and forgot about it.
Also, it is not normal (or up-to-date) to have Android SDK placed under Program Files.
This is the direct cause of the error. In Windows, writing files under Program Files requires administrator privileges.
Your system is possibly confused because you have a mixed environment with an SDK that requires administrator privileges and one that does not.
My advice is to first uninstall all of them.
Before you begin, find out where the Android Studio configuration files are stored and backup them.
It is documented in here.
Now, completely uninstall all versions of Android Studio and Android SDK, manually delete all environment variables related to Android if any, manually delete (and backup) all configuration files if the uninstaller did not, then make sure all four directories above are empty.
Next, install the latest version of Android Studio and install the Android SDK via Android Studio. At this point, make sure that the installation directory is not under Program Files or Program Files (x86). If it is, then something in the older version is still there and is doing bad things so you have to restart from the first step.
Finally, run flutter clean (just to be sure), then flutter doctor to make sure only one of each is detected.
In android studio update your sdk 30
Unable to determine bundled Java version.
• Try updating or re-installing Android Studio
See in your error in flutter doctor
Change the ownership of Android SDK:
sudo chown -R $(whoami) $ANDROID_HOME
For this issue : Android license status unknown.
Type in command prompt
flutter doctor --android-licenses
Type Yes/y/Y to accept licenses
Maybe it's an emulator specific issue, did you try to run it on a real device?
Regarding the android license issue you are getting, I guess that the system is not recognizing JAVA or it needs to be updated so please check that.
Also make sure that the emulator itself is updated and not only the android SDK, go to SDK manager and check all the dashed components:
If this didn't work, delete the emulator and create a new one, and if that didn't help, delete all instances of android studio as I see 2 on your system that might conflict the SDK path.
I am facing problems with the build of my apps(the old ones are working but all my new projects are receiving this message)
i already tried rebooting my pc and reinstalling flutter, but this doesn't change the error, and i can't find the solution anywhere
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
'D:\projects\CalendarProject' is not recognized as an internal or external command,
operable program or batch file.
Exception: Gradle task assembleDebug failed with exit code 1
this projects\CalendarProject is a old project, but every project i try to build i receive this message pointing to D:\projects\CalendarProject
also my flutter doctor seems perfectly fine
[√] Flutter (Channel stable, 1.20.4, on Microsoft Windows [Version 10.0.18363.1082], locale en-US)
• Flutter version 1.20.4 at C:\src\flutter
• Framework revision fba99f6cf9 (4 days ago), 2020-09-14 15:32:52 -0700
• Engine revision d1bc06f032
• Dart version 2.9.2
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at D:\android\AndroidVirtual
• Platform android-29, build-tools 29.0.3
• ANDROID_SDK_ROOT = D:\android\AndroidVirtual
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 44.0.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[!] IntelliJ IDEA Community Edition (version 2019.1)
• IntelliJ at C:\Users\Joâo Pedro\IntelliJ IDEA Community Edition 2019.1.3
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins
[√] VS Code (version 1.49.0)
• VS Code at C:\Users\Joâo Pedro\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.14.1
[√] Connected device (1 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
I think it is a config in android folder that is generating this error, but can't imagine what could it be
Are you using flutter in android studio? if so, try opening the project in "vs code", there seems to be a problem with flutter in android studio...
Solved:
the folder that i was using to create projects was inside a folder called "D:\projects\CalendarProject(V3)" (exemple:D:\projects\CalendarProject(V3)\flutter_app)
, don't know is it is a android sdk or flutter bug, but apperently one of them thought CalendarProject(V3) was a function and was trying to run it. this explains the message
'D:\projects\CalendarProject' is not recognized as an internal or external command,
operable program or batch file.
Fixed by changing the directory
you can recreate the error with:
>>mkdir teste(v3)
>>cd "teste(v3)"
>>flutter create app
>>cd app
>>flutter build apk
My app works perfectly on the Android emulator. When I create a release APK I get this error:
Intermittently, the Scaffold content does not load. The Nav bar and drawer are visible, but not the central content.
This does not happen every time I open the app, only about 1/3 times, on average. There is no obvious pattern to this working or failing.
[✓] Flutter (Channel stable, v1.12.13+hotfix.7, on Mac OS X 10.11.6 15G22010,
locale en)
• Flutter version 1.12.13+hotfix.7 at /Applications/flutter
• Framework revision 9f5ff2306b (3 days ago), 2020-01-26 22:38:26 -0800
• Engine revision a67792536c
• Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/dan/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling
support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✗] 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:
sudo gem install cocoapods
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)
[✓] VS Code (version 1.41.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.7.1
[✓] Connected device (1 available)
• klte • 5d3f96b0 • android-arm • Android 7.1.2 (API 25)
I have a similar case, the scaffold is not drawn, it is as if it were empty, for the moment the solution I found was to generate the apk but in debug mode, change flutter build apk --release to flutter build --debug .
since I upgraded my MacBook to macOS Catalina. I'm getting permanent the message ("ideviceinfo" could not be open, because the developer is not verified) despite I disabled the "spctl". can somebody help please?
I downloaded the flutter version flutter_macos_v1.9.1+hotfix.4-stable.zip AND i use the Andriod Studio 3.5.1.
[✓] Flutter (Channel stable, v1.9.1+hotfix.4, on Mac OS X 10.15 19A583, locale de-DE)
• Flutter version 1.9.1+hotfix.4 at /Users/yousefmosa/0/prg/flutter
• Framework revision cc949a8e8b (2 weeks ago), 2019-09-27 15:04:59 -0700
• Engine revision b863200c37
• Dart version 2.5.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/yousefmosa/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] Xcode - develop for iOS and macOS (Xcode 11.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.0, Build version 11A420a
✗ 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:
sudo gem install cocoapods
pod setup
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 40.1.2
• Dart plugin version 191.8423
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] IntelliJ IDEA Community Edition (version 2019.1.3)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 37.0.3
• Dart plugin version 191.7830
[✓] VS Code (version 1.37.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.3.0
[✓] Connected device (1 available)
• iPhone 11 Pro Max • XXX-6B2F-XXX-9B01-XXXXXX • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-0 (simulator)
! Doctor found issues in 2 categories.
From macOS "System Preferences..." > "Security & Privacy" > "General" tab ,
you see the dart entry. Just press "Allow Anyway"
Go to System preferences -> General and allow "dart" to run
Type these command in terminal
sudo xattr -d com.apple.quarantine YourflutterSDKLocation/bin/cache/artifacts/libimobiledevice/ideviceinfo
This is because of recent changes in macOS Catalina.
sudo spctl --add "Path_to_flutter/bin/cache/artifacts/libimobiledevice/ideviceinfo"
You might need to reboot the system in order to apply the changes.
You can run a GateKeeper script to fix the issue.
I have published an article with more information how to fix this.
Disclaimer: I am a newbie to using the emulators and flutter.
Question: How do I get flutter to connect to an emulator for debugging? Or, how do I create/set-up an emulated device properly so that my android studio flutter application recognizes it as a valid device?
I am not sure if it matters but I am currently working behind a proxy server. However, I have already added the appropriate certificates to the android ide.
The emulator I created is a Pixel 2, with API-28. I set it to allow developer options.
Using the new project part of the IDE I created a new flutter project in offline mode.
I expected the application to open in debug mode on my emulator but instead it says it doesn't think any device is connected. I ran flutter doctor and this is the output I received.
F:\SDKs\flutter_windows_v1.5.4-hotfix.2-stable\flutter\bin\flutter.bat doctor --verbose
[√] Flutter (Channel stable, v1.5.4-hotfix.2, on Microsoft Windows [Version 6.1.7601], locale en-US)
• Flutter version 1.5.4-hotfix.2 at F:\SDKs\flutter_windows_v1.5.4-hotfix.2-stable\flutter
• Framework revision 7a4c33425d (8 weeks ago), 2019-04-29 11:05:24 -0700
• Engine revision 52c7a1e849
• Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
• Android SDK at C:\Users\SWahlin-Rhoades\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.0
• Java binary at: F:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[√] Android Studio (version 3.4)
• Android Studio at F:\Program Files\Android\Android Studio
• Flutter plugin version 36.1.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[!] Connected device
• Device emulator-5554 is not authorized.
You might need to check your device for an authorization dialog.
! Doctor found issues in 1 category.
Process finished with exit code 0
I am aware of the thread device-emulator-55-is-not-authorized-android however, it didn't solve my problem. Within the thread it doesn't specify what new AVD was created in the solution and the other option of turing on developer settings didn't work.
I took another look at the Device_emulator_5554 answer and attempted to create another emulator Nexus S API 28 and I can now use it for debugging.