Android Studio how to Revert Using Services instead of Run? - android-studio

I would like to use the Run window in Android Studio for launching my run configurations (which is the default for projects).
I know that at some point I enabled the 8. Services window to be the default for one of my projects, however, I have no idea how to disable this again:
Any time I run anything in said project (launch an app, run tests, a command line app, etc.), it is launched in this Services windows, which has a bunch of annoying downsides in my opinion.
I do not want to delete the entire .idea directory of the project because I have many settings that I do not want to lose - it is just this one that bugs me.

Which run configurations are run in the Services window is determined by the Configurations availabe in Services list in Run/Debug Configurations -> Templates:
In there, you can simply remove or add any configurations that you want to have run in 8. Services or not.
Navigation
Run -> Edit Configurations... -> Templates -> Configurations available in Services
Thanks to #y.bedrov for pointing it out.

Related

how to enable or switch existing flutter project (mobile only) to MacOS or WEB or Linux or Windows?

I have made a flutter app only for mobile (Android and IOS). now client requested that make it for web/macOS/windows app.
so now how can I enable the existing projects for all other platforms or wise wars? here is all case I want to know
Existing on the web and adding other (mobile, windows, mac)
Existing on the web and adding only (mobile)
Existing on the Mobile and adding other (web, windows, mac)
Existing on Mobile and adding only (windows, mac)
Existing on the Mac and adding other (mobile, windows, web)
Existing on Windows and adding other (mobile, web)
many many thanks in advance. Questions and answers will be useful for many flutter developers in the future so if possible then a details answer will be appreciated!
flutter create --platforms=windows,macos,linux .
Is the one command that you need to run in terminal of your root project directory. You can specify platforms in the comma seperated list.
Like mentioned in the doc https://docs.flutter.dev/development/platform-integration/desktop#add-desktop-support-to-an-existing-flutter-app
List of platforms:https://docs.flutter.dev/development/platform-integration/desktop#add-desktop-support-to-an-existing-flutter-app
To enable disable platforms let say we want to disable ios altogether you can use and create a project later. Now you wont have ios as it is not available.
Well you can toggle the config and simply run the above mentioned command to go for ios
flutter config --no-enable-ios
You can follow this link for the config commands.
https://docs.flutter.dev/development/platform-integration/desktop#set-up
So lets say you have a case where you need to add only windows and mac you can disable other platforms and use the create command.
Now for the existing project if you want to enable or add a platform you can use the above create with platforms flag
NOTE:
CONFIG SETTINGS ARE USUALLY GLOBAL
There are many ways we can counter it. we can make use isolated development too complicated for simple usecase.
We can use FVM https://fvm.app/ for the configs so that it doesnot affect our core sdk.

When I run my app in android studio it runs a different app

I have two different projects (for simplicity I will call them project 1 and project 2).
When I run project 1 it runs just fine. However when I run project 2 for some reason it runs project 1. How may I be able to fix this.
Possible solutions are :
1. Reinstall the application or clear the cache from settings.
2. Restart the emulator without saving its state.

How to open a default folder when launching Visual Studio Code on newly provisioned machines?

How can I change settings.json (or whatever) so that when I launch VSC, that a workspace (or literally just a directory) opens up automatically.
I have already reviewed this other great answer How to open a default workspace when launching Visual Studio Code?
However I need to do this on brand new, newly provisioned machines that are ephemeral (meaning they get destroyed and recreated from scratch). That means that simply memorizing what I did once, does not help.
Also.... is there a way to do the same thing where the integrated terminal is already open as well? I can't seem to find knobs for either of the above in the settings.json.
This is on linux servers that students will open in their web browser using vs code server.

Visual Studio 2019 Processes not shutting down, NodeJS issues

I am working on a fresh install of Windows 10 Pro (10.0.18362) and trying to get Visual Studio 2019 setup and configured for .NET Core 3.1 Web Development but am running into several issues.
I created a default React.js ASP.NET Core Web Application and ran the project. Things seemed to be working alright, except that after updating JavaScript code the browser updates after a fairly long pause; things seem to be lagging.
After closing Visual Studio 2019 from the default Web App (no updates) there are several processes that seem to hang, and have to be shut down manually:
I have tried installing Visual Studio 2019 with the Node.js provided by the Visual Studio Installer, in addition to installing Node.js V12.4 and V13.6 manually with the same results.
Another problem: If I update the project from JavaScript to TypeScript using npx create-react-app client-app --typescript, Hot Updates stop working entirely. But after updating the JavaScript code and refreshing the browser things seem to update, so it does seem to be recompiling. I have tried debugging in Firefox and Chrome, both with the same results.
I am very hesitant to continue working with this install as I have had several issues when these processes. If these hang unexpectedly and are not shut down they will continue to use the old versions of the code and nothing that is done will update until the processes are shut down, causing complete insanity.
Could there a specific install procedure I need to perform as a workaround? Or am I possibly missing NuGet packages or Add-Ons? Since this is a fresh install of the operating system, are there Windows Features that I need to install? Or other configuration/permission changes that could be causing this?
Prior to this install, only projects created in Visual Studio 2017 seemed to work as expected. But I need to develop this site in .NET Core 3.0 and it looks like only Visual Studio 2019 is supported for that.
Update
After some messing around, it looks like Node is causing the problems. If I manually shut down the Node processes, then Visual Studio will finally shut down—but it leaves other processes like the VSCompiler and Consoles running. This happens even if I run Visual Studio as an administrator.
Should I install node before Visual Studio, or visa versa? Is there possibly some setup that I need to perform with Visual Studio or Node to get things working correctly?
Update 2
After not finding any fix I tried a complete reinstall of Windows, including a disk format, and then only installed Visual Studio and Node.js.
One interesting thing I found when doing this: I originally only installed Visual Studio and selected both the "Web Development" and "NodeJS Development". But when I tried to run a new .NET Core Web Application without any changes, I received an error saying that Node.js was not installed—even though I was able to find a node.exe in the MsBuilds folder under Visual Studio.
I completely uninstalled Visual Studio and all other components, installed Node.js, and then Visual Studio, but the problem still persists. Any time I try to run any kind of JavaScript using the SPA Templates, the Node.js processes don't shut down. If I kill the Node.js process then Visual Studio will finally shutdown, but it leaves the Console Window Host and VBCSCompiler running which have to be shut down manually.
I also tried creating a new .NET Core Web Application, except this time selecting the Angular Template and it works better: The Hot Reload works and it seems to run much faster. But the processes still don't shut down. The only difference is killing the Node.js processes doesn't let Visual Studio shutdown.
Update 3
Also not sure if this helps, but I tried setting the node.exe properties to "Run this program as an Administrator" to see if it happen to be a permission issue. This yielded the same results. I noticed that two windows will pop up, however: First a blank one, then the actual Angular server window.
I'm not sure if it's related, but when I tried to run the Angular Application again it looks like Angular is pointing at another (random) port than is set in the debug settings in the project.
One thing I did notice is that the usual Server Messages are not showing in the Output Window. It used to display the node.js messages such as "the server is running" and other compiler messages, but now it only displays the .NET output.
Update 4
Getting closer, I uninstalled Visual Studio and Node.js, then made sure to clean out any left over Visual Studio and node_modules folders from my AppData and User/Local directories, and then did a disk cleanup. Finally, I reinstalled Visual Studio—making sure to run the installer as Admin—and reinstalled Node.js.
I ran Visual Studio as an admin and created a new Angular App. Now, the Angular app works as expected, HMR works and things seem to run smoothly except that the processes still hang. The major difference is that killing the Microsoft Visual Studio 2019 process kills everything, whereas before it was leaving the VBSCCompiler, Node.js and consoles running.
When creating a React App things load fine. But, again, the HMR doesn't work and also leaves processes running. shutting down the main Visual Studio process seems to clean these up now too.
I'm afraid I don't have a fix but if anyone wants a quick way to kill all the errant node processes and speed things back up they can run:
taskkill /IM "node.exe" /F
I haven't had any issues executing this while VS is running.
In Visual Studio 2019, go to Tools, Options, Debugging, General and towards the bottom there is a checkbox for Automatically close the console when debugging stops. It is unchecked by default on new versions of VS and if you look at your ASP.NET Core project properties you will see that it is a console project. So without the checkbox checked, the console does not automatically close.
The problem is that it is a hidden console so you can't see it to shut it down manually. If you check the box for closing the console automatically, then the consoles and node.js will stop running whenever you stop the debugger. Also in Options, there is a Node.Js Tools area that you may want to look at as well. It has a checkbox for Wait for input when process exits abnormally. If the console is hidden, there is no way for you to do input so that could hold the process open as well.
Another option, if you don't want to change any of the debugging options, is to go to your project properties > Debug and change the Launch settings for the IIS Express profile to Project instead of IIS Express. This will actually make the console / command prompt visible and when you are done debugging you can Ctrl-C to stop the debugger or when you hit stop the console will give you the message to Press any key to close this window . . .
I had the same issue with React SPA, this worked for me:
Tools -> Options -> Debugging -> General -> Enable JavaScript debugging for ASP.NET (Chrome, Edge and IE) (Visual Studio 2017 and 2019) <- unchecked
also the dropdown next to the play button:
Script Debugging -> disabled
There are possibilities to run pre and post build tasks in Visual Studio. I would look for them in project settings.
I use VSCode. So, if you follow the explanation below you'll be able to tackle the problem.
Create a .bat file in your project root folder (for instance kill-node.bat) with the followwing content:
tasklist | find /i "node.exe" && taskkill /im node.exe /F || echo process "node.exe" not running.
Add a pre-build-task executing the .bat file
Add a post-build-task executing the .bat file
Done! Now every single time you start debugging/redebugging your app, the .bat file kills all node-zombie instances. And ditto for your stopping dubug moment.
The VSCode guide:
Perform step 1 of the algorithm above.
Open the file tasks.json in .vscode folder and prepend at top of its tasks the new one:
{
"label": "kill-node",
"command": "kill-node.bat"
},
Now alter the build task code (to activate our kill-node task at the pre-build time):
{
"label": "build",
"dependsOn": "kill-node", // <<< extra string to run kill-node task prior to build task
"command": "dotnet",
//... the rest of build task code
}
Open launch.json file and insert new string:
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"postDebugTask": "kill-node", // <<< extra string to run kill-node on debug end
//... the rest of launch.json file
}
}
That's it. Now you can no longer care of the node-zombie instances consuming your memory.
This should be fixed in ASP.NET Core 5.0, try upgrading if possible.

VS2012 Build page has not effect on debug or release settings?

I am trying to build a project for release in VS2012.
I got to Properties->Build and change the configuration to Release, set my platform (x86) and rebuild expecting the code to be optimized and put in the x86/Release folder.
The code is placed in the same Debug folder and I can still do real-time debugging which means in is not release.
If I go to the Configuration Manager I can change the Active solution configuration to Debug or Release and that works, but once again regardless of how the build page is configured.
I want to the Build page to control how the project is build not the configuration manager as it did in VS 2008 and 2010.
All online resources talk about using the build tab for control and the configuration manager for adding new Configurations, but nothing about requiring the configuration manager.
The Build page doesn't control which configuration you're building, it only controls what the settings are for each configuration.
To change the active Configuration, you need to use the Configuration Manager or the Solution Configurations dropdown in the toolbar.

Resources