Can not reset flutter sdk path on Visual Studio - visual-studio

Unfortunately, I set incorrect path for flutter sdk on Visual Studio and now I am trying to reset the path , but can't , Is it possible to reset ?
Visual Studio said :
Warning! The 'flutter' tool you are currently running is from a
different Flutter repository than the one last used by this package.
The repository from which the 'flutter' tool is currently executing
will be used instead. running Flutter tool: /home/zayniddin/flutter
previous reference :
/home/zayniddin/Downloads/flutter_linux_v0.7.3-beta/flutter This can
happen when you have multiple copies of flutter installed. Please
check your system path to verify that you are running the expected
version (run 'flutter --version' to see which flutter is on your
path).

After changing the Path in your machine,
run flutter upgrade. Weird but works for me

Related

Flutter windows build: Nuget is not installed

I uninstalled Visual Studio 2019 and installed it as 2022.
I reinstalled Flutter.
When building Flutter desktop, the following problem is repeated.
If I run it in another project, it works without any problem.
Launching lib\main.dart on Windows in debug mode...
Building Windows application...
Nuget is not installed.
Nuget.exe not found, trying to download or use cached version.
1- make sure you have installed Visual Studio
2-
NuGet Package Manager (PM UI and PM Console) is included with Visual
Studio. The latest NuGet releases are delivered as part of Visual
Studio updates.
HOWEVER: nuget.exe itself is not included with any version of Visual Studio.
so you need to download the latest NuGet Windows x86 Commandline from https://www.nuget.org/downloads
3- put it inside the flutter sdk folder or any folder you like
4- copy the folder path
5- in windows serach, search for env so you can put it as system variables. edit path with a new line and past the folder path
6- restart android studio
7- congrats
there's a video on youtube for the exact steps:
https://www.youtube.com/watch?v=J5b5sj6mG8M
Although I don't know why it would work without this error message on the same machine, I recently ran into this issue as well. The way I fixed it was to download the nuget executable and add it to my path.

How to build release version of windows app?

How to build release version of windows app in flutter and where to find the build file ?
Actually I have build the windows app using flutter build windows but am not able to locate the file which could to installed to other desktops and could be used further on .
Flutter doctor output :-
H:\window app flutter\windowsapp>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, 1.22.0-2.0.pre.36, on Microsoft Windows [Version 10.0.18363.1082], locale en-IN)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.7.5)
[√] Android Studio (version 4.0)
[√] VS Code (version 1.50.0)
[√] Connected device (4 available)
• No issues found!
Please help 🙂
Flutter 2.10 arrives with stable support for building Windows app.
You can use flutter build windows and it will do the build for you.
Make sure to install Desktop development with C++.
The build .exe file can be found on ...\projectName\build\windows\runner\Release\
You can use msix package for build. To build using msix you need to enable developer mode on Windows.
Type start ms-settings:developers and it will open the setting and enable it.
Open Command prompt (as Administrator if you needed) and navigate to your project directory and type these command
flutter build windows
flutter pub run msix:create
You will get an .msix app that will install the usual way windows does.
You can also configuring your installer.
For more details go to https://flutter.dev/desktop
The executable can be found in your project under
build\windows\runner<build mode>. In addition to that executable,
you need the following:
From the same directory:
all the .dll files
the data directory
The Visual C++ redistributable
You can use any of the methods shown in the deployment example walkthroughs on the Microsoft site.
If you use the application-local option, you need to copy:
msvcp140.dll
vcruntime140.dll
vcruntime140_1.dll
Place the DLL files in a directory next to the executable and the other DLLs, and bundle them together in a zip file.
Yes!
So I found the release build in this folder after executing flutter build windows :-
windowsapp\build\windows\runner\Release
Here windowsapp is the main app directory
Note - For further distribution you'll need to zip the content present
inside the Release folder and distribute the same zipped file.

Unable to change the location of Installation in VS2017

How to change the installation location in VS2017, currently its showing in the gray shade (Read-only) like:
Please check this doc: Change the installation locations in VS 2017 and those locations is set with your first installation and cannot be changed later from the installer UI. If you just want to move the download cache, you can use command-line parameters and for others, please try to clean up the installed VS like the following and re-install it:
• See if you have this file on your machine: "%programfiles(x86)%\Microsoft Visual Studio\Installer\resources\app\layout\InstallCleanup.exe"
• If so, please launch it from an admin command prompt with a -full param:
InstallCleanup.exe -full
• If not, please manually delete the "%programfiles(x86)%\Microsoft Visual Studio\Installer” folder
• Relaunch the newly downloaded vs_enterprise.exe (or vs_professional.exe or vs_community.exe…)
• Allow the first step to install the installer
• Once the installer comes up and you can see workload choices (.net desktop and the like), close it
• Go launch the same InstallCleanup.exe to clean up old build of VS
• Then re-run the VS installer to install
BTW, this method can reduce the installation footprint on your system drive but there are some tools and SDKs that have different rules on where they can be are installed. These tools and SDKs will still be installed on your system drive even if you choose another location.

Xamarin vstool build cannot find NuGet MSBuild targets

Background
I recently converted my Xamarin.Forms app from PCL to Net Standard format.
All of my projects now use PackageReference in the csproj file. Which means no more package.config or package.json.
We use TFS 2015 to build, sign, package our .ipa and .apk files. After conversion, the default MSBUILD build steps do not work as they look for mdtool and the new Visual Studio has vstool instead. So, I updated the build steps to use new tools via command line.
All my projects are NetStandard now (including iOS and Android).
Issue
I can successfully restore NuGet packages using restore MySolution.sln -force on Mac build server. But when I run vstool build MySolution.sln after that, I get this error:
error: NuGet packages need to be restored before building. NuGet
MSBuild targets are missing and are needed for building. The NuGet
MSBuild targets are generated when the NuGet packages are restored.
I am able to successfully run the nuget restore and vstool build locally on the build machine. But only when TFS runs the command via agent, it shows that error message.
Setup
Builds: TFS 2015 on Mac agent running Visual Studio 7.5
According to the error and your description, you need also check if your build agent has corresponding capability to support vsbuild.
Take a look at this related question MacOS - Visual Studio Support and give a try with this workaround:
As a work around we set the Xamarin.iOS variable manually in the build
agent and changed the mdtool path in the Xamarin iOS Build step to
"/Applications/Visual Studio.app/Contents/MacOS/vstool".
Besides you could also try to use the suggestion from Matt in the comment above.
Ok. I was finally able to get a successful iOS build on Mac server. This is the setup that works,
Using PackageReference in iOS .csproj
No package.config, project.json, or AssemblyInfo.cs file.
Running nuget restore .sln before building the iOS project.
Build solution using <path-to-vstool>\vstool build .sln -c:<configuration>
Now, I am working on the Windows machine for Android setup. Once I have that working, I will post my findings here.

Error Copy android SDK folder from windows to mac?

What steps i followed:
Deleted SDK folder placed on MAC after installing Android Studio
Copy SDK folder from windows and pasted it on same location as previous SDK folder was placed .
Now Following Errors Keeps occurring:
When Rebuilding Project Gradle Build Error
When Clicking on StandAlone SDK manager Not found "my path" error=2 something something
When clicking on Run button exception adb not found occur
And many other issues
My Attempts in resolving issues:
1 - Installed All Gradle build latest and previous and tried to change my buildToolsVersion and support appcompat v7 on all of them finally one worked, build version 23.0.0 which is installed. (Hope Fully Resolved Gradle Build Error)
2 - Manually installed Tools folder for mac and replaced it with Tools folder in SDK folder
3 - Tried to Bribe my laptop and Android Studio , didn't work out though
Now why i did something like this? To save my bandwidth i have 78GB of SDK folder in windows and didn't want to waste my bandwidth installing all SDK's again , so Kindly suggest a workaround/solution

Resources