How to enable Windows UWP for flutter? - windows

I followed https://medium.com/flutter-community/publishing-flutter-windows-apps-to-microsoft-partner-center-with-codemagic-b1962575510c but the channel dev and beta do not have the option to enable uwp:
Flutter 3.1.0-9.0.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision f28e570c8c (5 weeks ago) • 2022-06-14 13:39:33 -0500
Engine • revision 74ee6b5afd
Tools • Dart 2.18.0 (build 2.18.0-165.1.beta) • DevTools 2.14.0
PS C:\Users\lz> flutter config --enable-windows-uwp-desktop
Could not find an option named "enable-windows-uwp-desktop".
Run 'flutter -h' (or 'flutter <command> -h') for available flutter commands and options.
channel dev (which is deprecated) also gives the same error.
On stable it has the option:
[✓] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.19044.1288], locale en-GB)
PS C:\Users\me> flutter config --enable-windows-uwp-desktop
Setting "enable-windows-uwp-desktop" value to "true".
You may need to restart any open editors for them to read new settings.
However when I do flutter create myapp, it only has a windows folder (win32) not a winuwp like it should.
I'm on Windows 10, fresh Flutter and Visual Studio SDK installation with Windows 10 SDK C++ installed.

As UWP is being phased out by Microsoft, the Flutter team is focusing on the Win32 side instead to limit the scope. The support for UWP was removed entirely here.
Check out the main issue here: https://github.com/flutter/flutter/issues/14967#issuecomment-1085490495

Related

Flutter desktop MacOS - Unable to create FlutterView

Latest Flutter stable, version 3.7 on MacOS. Hello world application (created with flutter create command). Everything is fine on iPhone and web (Chrome). But if I try to flutter run macOS, I'm getting error:
and empty window displayed.
~ % flutter doctor -v
[✓] Flutter (Channel stable, 3.7.0, on macOS 13.1 22C65 darwin-x64, locale
pl-PL)
• Flutter version 3.7.0 on channel stable at
/usr/local/Caskroom/flutter/3.7.0/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision b06b8b2710 (7 days ago), 2023-01-23 16:55:55 -0800
• Engine revision b24591ed32
• Dart version 2.19.0
• DevTools version 2.20.1
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from:
https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK
components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup
for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14C18
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[!] Android Studio (not installed)
• Android Studio not found; download from
https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup
for detailed instructions).
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-x64 • macOS 13.1 22C65 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 109.0.5414.119
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 2 categories.
What's wrong?
It seems that Flutter won't work in VMs anymore as they have removed OpenGL support in version 3.7.0 https://github.com/flutter/flutter/issues/108304

Flutter Desktop Application Running error MSB4100

So, what I was trying to do is to build Windows desktop apps with Flutter. I just followed all the steps of installation that were written in the documentation of Flutter. I just created a simple boilerplate with the command flutter create learningflutter on my Windows 11 machine. Then I just run the flutter run -d windows command inside the directory (learningflutter), then ended up with this error:
$ flutter run -d windows
Launching lib\main.dart on Windows in debug mode...
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(469,26): error MSB4100: Expected "$([System.String]::new('%(Link.AdditionalDependencies)').Contains('atls.lib'))" to evaluate to a boolean instead of "$([System.String]::new('..\flutter\Debug\flutter_wrapper_app.lib;D:\Adil's Files\My Code\learningflutter\windows\flutter\ephemeral\flutter_windows.dll.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib').Contains('atls.lib'))", in condition "'$(ATL_KeyFile)' != '' and ('$(ConfigurationType)' == 'Application' or '$(ConfigurationType)' == 'DynamicLibrary') [D:\Adil's Files\My Code\learningflutter\build\windows\runner\learningflutter.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(469,26): error MSB4100: and %(Link.AdditionalDependencies) != '' and $([System.String]::new('%(Link.AdditionalDependencies)').Contains('atls.lib'))". [D:\Adil's Files\My Code\learningflutter\build\windows\runner\learningflutter.vcxproj]
Building Windows application...
Exception: Build process failed.
I was looking for how to fix this problem. Would be appreciated if you teachers can help me out with this problem!
My Flutter Doctor configuration:
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 2.13.0-0.0.pre.498, on Microsoft Windows [Version 10.0.22593.1], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ 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
[✓] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.3)
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.66.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
! Doctor found issues in 1 category.
You can say that I have literally no idea about Flutter, and never made a mobile app with it. So, you can treat me a newbie and please explain why you did this or that or whatever so that I can learn.
If you need more information, please ask for it explicitly. I never dealt with these problems before so I don't really know specifically what to include as a reference! Thanks for your consideration!
Thank you Sir/Ma'am!
Make sure that you downloaded cmdline-tools
Run path/to/sdkmanager --install "cmdline-tools;latest"
and for the sdk license issue you may check this.

I can't create virtual device through android studio, nor configure my phone with adb

Error Creating AVD
An error occurred while creating the AVD. See idea.log for details.
I use windows 11, latest version available today. I don't use android studio to program, I use VSCode and program with flutter, I haven't used this PC for a while, and now besides not being able to create an AVD (virtualization is enabled in the bios), I can't connect my cell phone to send it to it, this it returns to me in the terminal when I try to connect by wifi:
{path}\Sdk\platform-tools> ./adb pair 191.52.129.80:43883
Enter pairing code: 485667
* daemon not running; starting now at tcp:5037
* daemon started successfully
error: protocol fault (couldn't read status length): connection reset
When I connect by usb cable, it returns me this:
! Device RX8N207HSZK is not authorized.
You might need to check your device for an authorization dialog.
Since I already authorized everything and on my other computer it works.
Java version:
Picked up _JAVA_OPTIONS: -Xmx512M
java 17 2021-09-14 LTS
Java(TM) SE Runtime Environment (build 17+35-LTS-2724)
Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing)
Flutter version:
Flutter 2.10.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 7e9793dee1 (31 hours ago) • 2022-03-02 11:23:12 -0600
Engine • revision bd539267b4
Tools • Dart 2.16.1 • DevTools 2.9.2
Below I will leave all flutter doctor information with the -v parameter:
[✓] Flutter (Channel stable, 2.10.3, on Microsoft Windows [version 10.0.22000.493], locale pt-BR)
• Flutter version 2.10.3 at C:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7e9793dee1 (31 hours 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 32.1.0-rc1)
• Android SDK at C:\Users\pedro\AppData\Local\Android\sdk
• Platform android-32, build-tools 32.1.0-rc1
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version openjdk version "11.0.11" 2021-04-20
• 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 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 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 version "11.0.11" 2021-04-20
[✓] VS Code (version 1.64.2)
• VS Code at C:\Users\pedro\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.36.0
[✓] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [version 10.0.22000.493]
• Chrome (web) • chrome • web-javascript • Google Chrome 99.0.4844.51
• Edge (web) • edge • web-javascript • Microsoft Edge 98.0.1108.62
! Device RX8N207HSZK is not authorized.
You might need to check your device for an authorization dialog.
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
In short: I'm desperate for a solution, I've already tried deleting android studio from the locations I knew ('user/{user_name}/Android', 'AppData/local/Android' and 'AppData/roaming/Google/AndroidStudio') as well as android studio folder in program files and reinstall it, I tried to reinstall flutter and java and also nothing, I hope I don't need to format my machine :'(
I managed to solve the problem in a bizarre way. I copied the '.android' folder from another working computer and pasted it into this one and it worked.

Error: Expected ios/Runner.xcodeproj but this file is missing

I am getting the issue after reinstall my Xcode from 13.2 beta version to 13.2.1 release version, by-mistake I have deleted my project build folder & runner.
Expected ios/Runner.xcodeproj but this file is missing. No application
found for TargetPlatform.ios. Is your project missing an
ios/Runner/Info.plist? Consider running "flutter create ." to create
one.
I also gone through it's suggestion
flutter create .
but still having the same issue. my flutter doctor -v result is
apple#apples-Mac-mini test_ios % flutter doctor -v
[✓] Flutter
(Channel stable, 2.8.1, on macOS 11.6.1 20G224 darwin-x64, locale
en-GB)
• Flutter version 2.8.1 at /Users/apple/Desktop/flutter_sdk/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 77d935af4d (12 days ago), 2021-12-16 08:37:33 -0800
• Engine revision 890a5fca2e
• Dart version 2.15.1
[✓] Android toolchain - develop for Android devices (Android SDK
version 31.0.0)
• Android SDK at /Users/apple/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• ANDROID_HOME = /Users/apple/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Users/apple/Downloads/Xcode.app/Contents/Developer
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.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.10+0-b96-7281165)
[✓] Connected device (2 available)
• iPod touch (7th generation) (mobile) • A7FF5F55-96CF-4DD4-9790-6162A82AA0B7 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.110
• No issues found!
also I have created the new flutter project from Android Studio but unfortunately it is also not containing the same file.
I had the same issue after I manually deleted xcode profile using xcode IDE.
Please try the following:
Create a new flutter project.
Run the project - confirm its in good working order (you will see xcode compilation)
3)I copied all files under ios folder of the new project to my current one & it worked like a charm.
Good luck.
Unfortunately I could not get solution online I had to try my own ways and it worked. This error occurs when you update Xcode. For me I downloaded the Xcode beta, and installed it then recreated the project
. You can extract if you have a backup. Then run Xcode beta simulator. That all. ALL the best.
Some how i found the files Runner.xcodeproj and Runner.xcworspace in bin and restoring them back solved my issues!

How to fix flutter doctor error android studio not installed, and IntelliJ IDEA, even though I've installed it already

I'm a beginner at learning flutter. I've installed Android Studio and flutter. I ran the command flutter --version on Windows Powershell and the output I received is Flutter 2.2.3 • channel stable • https://github.com/flutter/flutter.git Framework • revision f4abaa0735 (2 months ago) • 2021-07-01 12:46:11 -0700 Engine • revision 241c87ad80 Tools • Dart 2.13.4
The next command I ran was flutter doctor and I received output as:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [Version 10.0.19041.1165], locale en-IN)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
X Cannot execute C:\Users\lenovo\IntelliJ IDEA Community Edition 2021.1\bin\java to determine the version
[√] Chrome - develop for the web
[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 (not installed)
[√] Connected device (3 available)
! Doctor found issues in 3 categories.
Can anyone please help me in fixing this issue?
I've the same issue on Windows. This does not seem to happen on Linux (Ubuntu) for me.
But it's a warning you can ignore. Even if Flutter Doctor does not recognize Android Studio, you can still use it in Android Studio if everything else is set up.

Resources