Flutter - running command "flutter _____" instantly closes terminal - windows

Dealing with some significant frustration trying to set up my environment variables just to run Flutter. in my path, I've tried many suggestions to try setting up my Path route so that the Flutter Console (or cmd) can successfully run the command "flutter doctor" just to download all the packages, etc. But the problem is as soon as I run this command, it instantly closes my terminal. There isn't anything happening, the terminal just closes. Any help would be appreciated, and I've attached my screenshots of my Path envs to maybe help out some more.
envs

I also get the same problem i.e whenever I hit the flutter doctor command; the terminal instantly closes.
Solution :
Add the following to the system variable path.
C:\Windows\System32\WindowsPowerShell\v1.0
everything will work fine

I was facing the same issue and I resolved it: the problem was PowerShell version.
I am using Windows 8 and by default it has version 4.
Flutter needs version 5.0, so I upgraded my PowerShell.

Add this to system variable PATH:
C:\Windows\System32\WindowsPowerShell\v1.0
Open cmd as admin and set variables:
setx /M FLUTTER_HOME "C:\flutter" <---- here folder where your flutter is
setx /M PATH "%FLUTTER_HOME%\bin;%PATH%"

Add PowerShell path to your PATH in environment variables if not exists.
In my case C:\Windows\System32\WindowsPowerShell\v1.0 added to the PATH

Add Only these in the path and it will surely work. ONLY FOR WINDOWS
enter image description here

Note: Flutter relies on a full installation of Android Studio to
supply its Android platform dependencies. However, you can write your
Flutter apps in a number of editors; a later step discusses that.
(https://flutter.dev/docs/get-started/install/windows)
You could try to install android studio on your machine and try again.

Download Flutter SDK again and change your Flutter SDK path and update new path in
environment variable and restart your IDE

The problem is of powershell only. In my case I mistakenly used ; at the end of path which was creating problem.

Perhaps it's like when you run a bat file and Windows closes it because there's no pause command at the end?
When I ran a bat file with the same command from sublime, i saw that it said this in sublime's output...
C:\!\flutter>flutter doctor
Error: The Flutter directory is not a clone of the GitHub project.
The flutter tool requires Git in order to operate properly;
to set up Flutter, run the following command:
git clone -b stable https://github.com/flutter/flutter.git
Solution: Put your folder at C:\flutter. I don't know why but it fixed this. My PATH is C:\flutter\bin. The "location of the sdk" is C:\flutter.

I have the solution
go to C:/ in windows
create a src folder
into your src folder run this
git clone -b stable https://github.com/flutter/flutter.git
setup your env variables with this path= C:/src/flutter
problem solved!

For me the problem was, that in my BIOS the Virtualization Technology.

in my case non of the answers worked even adding C:\Windows\System32\WindowsPowerShell\v1.0 didn't fix the problem.
the only solution that worked for me is running the command or terminal as an administrator

Related

How to use git commands in Visual Studio 2019 Integrated Terminal [duplicate]

Visual Studio Code reports "It look like git is not installed on your system." when I try to switch to the git view. I know I have git installed and used by other Git clients. I guess if I reinstall Git following Visual Studio Code's instruction ("install it with Chocolatey or download it from git-scm.com"), it probably can fix the problem, but I don't want to mess up the existing Git clients on my system. Is there a reliable way to configure Visual Studio Code so it can find existing git installation?
Now you can configure Visual Studio Code (version 0.10.2, check for older versions) to use an existing Git installation.
Just add the path to the Git executable in your Visual Studio Code settings (menu File → Preferences → Settings) like this:
{
// Is Git enabled
"git.enabled": true,
// Path to the Git executable
"git.path": "C:\\path\\to\\git.exe"
// Other settings
}
Update 2020 (Mac)
I went through this $h!† again after updating to macOS v10.15 (Catalina), which requires an Xcode update.
And to clarify, while this post is about Visual Studio Code, this issue, is system wide. Your Git install is affected/hosed. You can try to run git in your terminal, Bash, Z shell (zsh), or whatever. It is now and it just won't.
It is the same fix. Just update Xcode. Start it up and agree to the license. That's it.
I hit this on Mac/OS X.
Symptoms:
You've been using Visual Studio Code for some time and have don’t have any issues with Git
You install Xcode (for whatever reason - OS update, etc.)
After installing Xcode, Visual Studio Code suddenly "can't find Git and asks you to either install or set the Path in settings"
Quick fix:
Run Xcode (for the first time, after installing) and agree to license. That's it.
How I stumbled upon this "fix":
After going through numerous tips about checking git, e.g., which git and git --version, the latter actually offered clues with this Terminal message:
Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.
As to why Xcode would even wrap it's hands on git, WAT.
Visual Studio Code simply looks in your PATH for git. Many UI clients ship with a "Portable Git" for simplicity, and do not add git to the path.
If you add your existing git client to your PATH (so that it can find git.exe), Visual Studio Code should enable Git source control management.
This can happen after upgrading macOS. Try running Git from a terminal and see if the error message begins with:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) ...
If so, the fix is to run:
xcode-select --install
from the terminal. See this answer for more details.
I had this problem after upgrading to macOS v10.15 (Catalina).
The issue is resolved as follows:
1.
Find the Git location from the terminal:
which git
2.
Add the location of Git in settings file with your location:
settings.json
"git.path": "/usr/local/bin/git",
Depending on your platform, the user settings file (settings.json) is located here:
Windows %APPDATA%\Code\User\settings.json
macOS $HOME/Library/Application Support/Code/User/settings.json
Linux $HOME/.config/Code/User/settings.json
In Visual Studio Code, open 'User Settings': Ctrl + P and type >sett. Press Enter.
This will open the default settings on the left side and User Settings on the right side.
Just add the path to git.exe in user settings:
"git.path": "C:\\Users\\[WINDOWS_USER]\\AppData\\Local\\Programs\\Git\\bin\\git.exe"
Replace [WINDOWS_USER] with your user name.
Restart Visual Studio Code.
First check if Git* is installed or not in your system by typing the command in cmd /command prompt (in Windows):
where git
If you get an output like this,
λ where git
C:\cmder\vendor\git-for-windows\cmd\git.exe
Then Go to Settings → Preferences → Settings and put the bellow code** right part.
{
// If git enabled?
"git.enabled": true,
// Path to the Git executable
"git.path": "C:\\cmder\\vendor\\git-for-windows\\cmd\\git.exe"
}
If you don't have Git installed, install Git from https://git-scm.com/
** Just add a double slash (\\), just like the above code.
UPGRADE TO MacOS Ventura < 13.0
As of November 2022
Upgrading to MacOS Ventura does not seem to affect your coding environments too much.
After upgrading to macOS Ventura your Terminal and VScode will give off a few errors. Such as:
It look like git is not installed on your system ..
or
can't find Git and asks you to either install or set the Path in settings
some errors depend on your zsh setup or other customizations.
These common problems can be resolved by simply by reinstalling xcode command line tools and updating Homebrew - since your terminal might be affected reinstall from apples executable https://developer.apple.com/download/all/
developer.apple.com you will need to log in with your apple id.
Once installed, update Homebrew
brew upgrade
Mac M1 - M2 machines likely have some native and ARM applications so run:
arch -arm64 brew upgrade
Close all terminals and Vscode to restart!
reopen Vscode, errors should be gone.
If Vscode is still looking for Git path you will need to add it manually.
Find git location and copy from the terminal:
which git
and add the path to the git executable in your Visual Studio Code JSON settings file (File -> Preferences -> Settings) find and update the line - should look similar:
"git.path": "/usr/local/bin/git",
After an OS X update, I had to run xcode-select --install for GitLens to work.
Ran into the same problem after!
how I fixed it?
Step 1: Go to the Settings in vscode.
Step 2: Open settings.json.
Step 3: You need to find something like "git.path" in settings.json
Step 4: just add the directory path where git is installed in your system.
example : "git.path": "D:/Git/bin/git.exe"
Step 5: Restart your vscode.
Hope this helps.
Run
xcode-select --install it'll prompt you to install command line developer tools. Install the tools and installation restart your VScode.
You'll see git working once again in VScode
I ran into this problem after upgrading my macOS to Monterey.
It turned out that the xcode has been removed in the new update from my mac. Just tried the following suggested solution:
https://stackoverflow.com/a/52522566/11207358
VSCode 1.50 (Sept 2020) adds an interesting alternative with issue 85734:
Support multiple values for the git.path setting
I use VSCode in three different places; my home computer, my work computer, and as a portable version I carry on a drive when I need to use a machine that doesn't have it.
I use an extension to keep my settings synced up between editors, and the only issue I've encountered so far is that the git path doesn't match between any of them.
On my home machine I have it installed to C of course,
work likes to be funny and install it on A,
and for the one on my drive I have a relative path set so that no matter what letter my drive gets, that VSCode can always find git.
I already attempted to use an array myself just to see if it'd work:
"git.path": ["C:\\Program Files\\Git\\bin\\git.exe", "A:\\Git\\bin\\git.exe", "..\\..\\Git\\bin\\git.exe"],
But VSCode reads it as one entire value.
What I'd like is for it to recognize it as an array and then try each path in order until it finds Git or runs out of paths.
This is addressed with PR 85954 and commit c334da1.
with VSCode 1.60+
"git.enabled": true
git.path
I faced this problem on macOS v10.13.5 (High Sierra) after upgrading Xcode.
When I run the git command, I received the below message:
Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.
After running the sudo xcodebuild -license command, the below message appears:
You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode.
Hit the Enter key to view the license agreements at '/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf'
Typing the Enter key to open the license agreements and typing the space key to review details of it, until the below message appears:
By typing 'agree' you are agreeing to the terms of the software license agreements. Type 'print' to print them or anything else to cancel, [agree, print, cancel]
The final step is simply typing agree to sign with the license agreement.
After typing the git command, we can check that Visual Studio Code detected Git again.
I have recently started with Visual Studio Code. I have this issue and just writing the exact path of the Git executable solves
the issue. Here is the code:
"git.path": "C:\Program Files\Git\bin\git.exe",
If you have multiple environments. You could include Git Path in the Visual Studio Code Workspace Setting. For Windows, depending on your setting, you could hit Ctrl + P, search for "settings". Open settings.json (or menu File → Preferences → Settings). Navigate to Workspace Settings. Find "Path" and add paths to Git bin and cmd folders.
Environments can have their own paths. I discovered this when I echoed my PC %PATH% on cmd. Git bin and cmd path where available, but when I was working on my project, echoed %PATH% did not have git and cmd folder. Adding them, as shown above, solved the issue.
Extra Notes:
On cmd, you can echo "%PATH%" and see if git bin and cmd folders are included. If not, you could concatenate using SETX PATH on, for example,
SETX PATH "%PATH%;Path_to_Git_bin;Path_to_Gt_cmd;"
This will make git available on local, root but not in some environments which comes with their own paths (SETX /M PATH "%PATH%;Path_to_Git_bin;Path_to_Gt_cmd;" would have though).
In case you have a long Path that is chopped off due to Path length (getting "Error: Truncated at X characters." message), you can increase the path length in RegEdit.
In "Search Windows", search for "regedit". Right-click to open as Administrator.
Go to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
Right-click and modify. Change value data from 0 to 1
This will increase your path length. If it is already one, then I am not sure how to proceed from there :).
[9
The only way I could get to work in my Windows 8.1 is the following:
Add to system environment variables (not user variables):
c:\Users\USERNAME\AppData\Local\GitHub\PortableGit_YOURVERSION\bin\;c:\Users\USERNAME\AppData\Local\GitHub\PortableGit_YOURVERSION\libexec\git-core\;c:\Users\USERNAME\AppData\Local\GitHub\PortableGit_YOURVERSION\cmd\
This fixed the "it looks like git is not installed on your system" error on my Visual Studio Code.
Make sure git is enabled (File --> Preferences --> Git Enabled) as other have mentioned.
Make sure Gits installed and in the PATH (with the correct location, by default: C:\Program Files\Git\cmd) - PATH on system variables btw
Change default terminal, Powershell can be a bit funny, I recommend Git BASH but cmd is fine, this can be done by selecting the terminal dropdown and selecting 'set default shell' then creating a new terminal with the + button.
Restarting VS Code, sometimes Reboot if that fails.
Hope that helped, and last but not least, it's 'git' not 'Git'/'gat'. :)
In my case GIT was installed on my WIndows 10 OS and there was an entry in PATH variable. But VS CODE 1.52.1 still unable to detect it from terminal window but it was available in CMD console.
Problem was solved by switching terminal from PowerShell to CMD or Shell + VsCode restart.
I solved the same problem on MacOS with m1 pro processor by installing Git Lens Visual Code extension. The changed files were displayed after enabling the extension. Then I turned reloaded the VSCode and there was no changes, but once I run
git status
in terminal, it shows all the files, and all changes are tracked.
Faced this issue after updating macOS!
Installed git again using homebrew and it worked!
brew install git
FOR MAC
First, type
git
in the terminal and see what error you are getting.
Then:
If the error is related to Command Line tool!
Run:
xcode-select --install
And
Just go ahead and go through this answer, For Mac especially. Worked very easily for me.
https://apple.stackexchange.com/a/254381
Three years later, I ran into the same issue. Setting the path in user settings & PATH environment variable didn't help. I updated Visual Studio Code and that solved it.
First install Git onto your desktop, and then add the encircled extension in Visual Studio Code, as seen in the picture.
That helped me fix the same issue you have.
Open
C:\Users\nassim\AppData\Roaming\Code\User\settings.json
Comment any Git line there:
// ...
// "git-graph.integratedTerminalShell": "E:\\Apps\\Git\\bin\\bash.exe",
// "git.path": ""
//...
And add git.exe to the OS path.
Note for me: Fixing this Git error also fixed the npm error too. Since they are both defined in the path, if one fail, the remaining will fail as well.
Follow this :
1. File > Preferences > setting
2. In search type -> git path
3. Now scroll down a little > you will see "Git:path" section.
4. Click "Edit in settings.json".
5. Now just paste this path there "C:\\Program Files\\Git\\mingw64\\libexec\\git-core\\git.exe"
Restart VSCode and open new terminal in VSCode and try "git version"
In case still problem exists :
1. Inside terminal click on terminal options (1:Poweshell)
2. Select default shell
3. Select bash
open new terminal and change terminal option to 2:Bash
Again try "git version" - this should work :)
What worked for me was manually adding the path variable in my system.
I followed the instructions from Method 3 in this post:
https://appuals.com/fix-git-is-not-recognized-as-an-internal-or-external-command/
If git is missing after the OS update, in my case Big Sur, just literally: brew install git
I edited Path into System Environment and add "C:\Program Files\Git\bin" then restart Vscode. It's worked for me. I don't understand why I am using it normally then I have this problem. Maybe during the installation of something it causes that problem.
It worked for me just by installing git for windows, from this link https://git-scm.com/download/win
There was no need of setting environment variable or path.
Context:
I had installed VS Code, and github desktop, I cloned the repo using Github desktop.
When I opened repo, using VS Code, I saw this error.
I resolved by installing git for windows.

How do I completely Uninstall Flutter SDK from Windows

How do I completely uninstall Flutter SDK from Windows?
I tried to delete the Flutter Folder I had cloned from GitHub but that's not working for some reason.
You have to delete flutter extension in Android Studio if you installed it, then, check envirment variables then you removes paths if exists. Finally, kill adb.exe if it's running (this may blocks you in removing folder)
Go to C drive and delete flutter folder completely, if it shows that it Opened in some app, then just restart the device and delete the folder again, it worked for me.
If you go to the dir where you cloned dir and delete it. That should remove the command line tool.
rm -rf flutter
re-install git clone https://github.com/flutter/flutter.git -b stable
Uninstall Flutter with its uninstaller.exe.
to do that
a. Go to the installation folder of Flutter.
b. Find uninstall.exe or unins000.exe.
c. double click and run it.

"flutter doctor" not working

I've downloaded Flutter SDK as mentioned on https://flutter.io/setup-windows/ and also extracted it. Now when I try to run any Flutter command on the flutter_console.bat or any other CLI the prompts starts blinking forever and nothing happens! I've set the path correctly. Did not find any help from web!
Try running the flutter_console.bat as Administrator
If you delete cache folder under bin to solve some installation issues, this cause a endless loop in flutter doctor. This was my case.
I had the same issue when my flutter directory wasn't located directly in my C:/ drive ("C:/flutter")
I hope you have installed plug-in of flutter and dart
for the working of flutter doctor you need to create system environment variables of - flutter, git , cmd and powershell
like show in image just copy paste path of
**your path may different **
example:
C:\flutter\bin
C:\Windows\System32\WindowsPowerShell\v1.0
C:\Program Files\Git\cmd
C:\Program Files\Git\bin\git.exe
Encountered the same issue on windows. Try extracting the flutter folder in this path C:\Users\YourAccountName\AppData\Local.
Then edit your environment variable and add C:\Users\YourAccountName\AppData\Local\flutter\bin. This solved the issue for me.
I had the same problem, reason was our proxy. I unplugged the network cable and used mobile network of my smartphone via usb host function, that worked for me. After checking and configuring with flutter doctor every following attempt to start flutter doctor or flutter help was successful even with "normal" network.
I extracted flutter to C:\Program Files\ and had same problem. Running command prompt as Administrator did the trick for me. Or extract flutter to another dir where you don't need admin rights.
First, if in your system there is no git installed then first install git.
For my case, I just deleted the whole flutter folder. Download again, extract the folder, cut and paste to the c drive and then update both user variable path and system variable path. I added "C:\flutter\bin" this path inside user variable path and system variable path. Also make sure that:
C:\Windows\System32\WindowsPowerShell\v1.0
C:\Program Files\Git\cmd
C:\Program Files\Git\bin\git.exe
these paths are exist inside the system variable path. Finally I run "flutter doctor" and successfully it run. I also check "dart --version" and there is no problem.
(if you have any confusion about user variable path and system variable path then simply press widow button the type "env" then you will see "Edit the system Environment variables" then press enter and at the last you will see "Environment variables" clik on it and you will see 2 option for variable. One for user variable and another for system variable. select "path" for both and edit.)
My answer is somehow different, although I was using Visual Studio Code, I didn't find the flutter doctor option after pressing ctrl+shift+p.
I solved this issue after finding out, that I didn't choose the trusted system of Visual Studio.
open your path /flutter/bin
then delete cache folder
open terminal
flutter doctor -v
This will fix all problem.
you can just do this>
navigate to flutter bin
cd C:\flutter\bin
C:\flutter\bin> flutter doctor
I installed fresh right now and if you run flutter doctor with console under administrator rights it works for me. If not I have the same behavior as described in your post.
For some reason the latest version that I installed did not work! Installing lower version with same configuration worked!

The term 'node' is not recognized... In Powershell

I have been trying to resolve this issue for the whole day.
When I run node -v or npm install in cmd prompt, it works absolutely fine. But when I run the same commands in Powershell, it gives the following error:s
PS C:\Users\Anubhav.Trivedi> node -v
The term 'node' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelli
ng of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:5
+ node <<<< -v
+ CategoryInfo : ObjectNotFound: (node:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I tried uninstalling node js and reinstalling it. Added node js path C:\Program Files (x86)\nodejs\ to enviroment variables (system variables). Restarting computer. But nothing seems to work.
Kindly let me know, what am I missing here.
These issues cannot be installed from the Package Manager console, so I had to browse lot of things to fix the issues and finally I got the solution.
Maybe we followed these scenarios
Missing Node.js software
Wrongly updated Windows environment path
Installed in the wrong path
Old version of Node.js software
You can download the latest Node.js software here.
Update Path
After installation, automatically create nodejs folder in this path “C:\Program Files (x86)” or “C:\Program Files “.
Open Control Panel -> User Accounts -> Change my environmental variable and verify the path Variable value “C:\Program Files (x86)\nodejs” or “C:\Program Files\nodejs “.
new => user = path => value = C:\Program Files (x86)\nodejs and after apply that.
and close Editor and restart it. it will work correctly.
note :- enter your path instead of copy of this path.
As dan-gph mentioned check the Path in environment variable using script $env:path -split ';' | Select-String nodejs and once you update the Path in environment variable, make sure to restart powershell and also restart explorer.exe. This would resolve the issue.
If you still face issues, check which nodejs you have installed (32bit or 64bit). Install 32 bit only as powershell or cmd are 32bit programs
Model for VSCode editor
C:\Program Files\nodejs
C:\Program Files\nodejs\node_modules\npm\bin
Search PATH environment variable.
Add the above paths into the Environment variables (both user
variable path and system variable path).
Restart VSCode.
Open a new terminal in VSCode
run node --version output should equal v16.13.0
If you installed NodeJs recently after opening the IDE like Visual Studio Code or any other IDE that includes the terminal you are trying. then try this.
Restart the IDE, If you installed NodeJs recently after opening the IDE like Visual Studio Code or any other IDE that includes the terminal you are trying.
Restart the CommandLine if you installed NodeJs after you opened the CommandLine.
I hope it will be fixed most of the time by following these simple steps.
Happy Coding!
open control panel then--
user accounts
|
user accounts
|
change my environment variables
|
new
|
(In variable name use)--Path
|
(In variable value use)C:\Program Files\nodejs
|
ok
After that just restart you terminal
chances are that you messed up with your system path, if it's the case, a very straight forward solution will be re-installing node and npm but don't forget to close and re-open powershell/cmd
Note: i thought that restarting computer has no effect on path but in an accident someone just deplug my laptop from power and after i turned it on everything was repaired and OK!
Reinstall/repair the application and close the vs code powershell
I've got the same error. Simply check below instructions. If all they are done. Just restart your computer. Then it will worked for me. I just restarted my computer.
List item
Missing Node.js software
Wrongly updated Windows environment path
Installed in the wrong path
1.find nodejs folder
go to environment variable in windows
edit path and add "find nodejs folder"
Restart computer
This issue corrected after updated my environment variable path
i just copy the path from path value in user to path value in system check image attachment.
https://i.stack.imgur.com/11uCk.png
path change image below
Go to Control Panel\System and Security\System on Windows 10.
Go to advance properties.
Advance system settings -> advance system settings -> Environment Variables Or type edit the system environment variables in the windows search.
Add "C:\Program Files\nodejs" ,"C:\Program Files\nodejs" and "C:\Program Files\nodejs\node_modules\npm\bin" to the user and system variable (path)
restart the cmd and run again.
Hope it will work.

Android studio doesn't start

I just download Android Studio for Windows 7, the wizard went ok up to the end but now when I click on the shortcut or on the .exe to start the program nothing happens, no error, no new window, it's seems like it is doing nothing. Do you have any suggestion?
It's a bug of Android Studio 0.1v
You should add JAVA_HOME to the system environment variables.
http://tools.android.com/knownissues#as0.1
Open Start menu > computer > System Properties > Advanced System
Properties
In the Advanced tab > Environment Variables, add new system
variable JAVA_HOME that points to your JDK folder, for example C:\Program Files\Java\jdk1.7.0_21
Install latest Java Development Kit.
Set path in system variables for Java (ie *C:\Program Files\Java\jdk1.7.0_21\bin*)
Set JDK_HOME system variable (ie *C:\Program Files\Java\jdk1.7.0_21*)
If not working, set JAVA_HOME in system variable too (ie *C:\Program Files\Java\jdk1.7.0_21*)
If not working, check if you don't have spaces at the ends of the lines in system variables (PATH, JDK_HOME, JAVA_HOME)
You don't have to restart computer after changing system variables, just reload command prompt (if you are using it).
If it still not working, you probably have java.exe in C:/Windows/System32/. Rename it, restart command prompt and type java -version to check if you are using correct version of JDK.
I've posted tutorial how to fix Android Studio with screenshots on my blog.
I have had a similar problem with Android Studio 1.0 in windows 7 x64. When I ran studio64.exe it flashed the android studio logo and it disappeared immediately. Also I tried
studio64.exe > error.log
to figure out possible errors. JAVA_HOME=C:\Program Files\Java\jre1.8.0_25 environment variable was correctly setted.
Finally I decided to uninstall all Java versions (I had a mess of different java versions installed), both jdk and jre and reinstalled last version jdk 1.8.0_25. My problem was solved.
Regards,
Sometimes it might get stuck in memory. Open task manager, terminate android stuido. Open it up again.
If you install new the version of android studio.
It requires new jdk 1.8.
Just install the latest jdk 1.8 and android studio will work without the need to manually edit any environment variables.
You have to add a new system variable named ANDROID_STUDIO_JDK or JDK_HOME with the path to your JDK install folder, such as C:\Program Files\Java\jdk1.7.0_21\
I had the same exact problem and did try to do every thing manually nothing worked except for this command when I finished it finally launched. Open CMD with administrator if possible then put the following command:
set path="$PATH":C:\Program Files\Java\jdk1.7.0_21\bin
Then just try to launch it should work.
This is the only thing that worked for me.
Make sure you have Java 1.8 (JDK) or higher and update java_home and path to this version.
I did every tips but i checked AS requirements and updated jdk do 1.8.xx
It's possible there is a problem with your username (and name of the user folder). It shouldn't contain non-latin letters.
I had solved my problem (no response to an attempt to run Android studio) when I tried running the application as another Windows user (with name that consists of English letters only)
I got the same problem, but with no error message.
I found a studio.bat file and dig in it. There, I found some tips:
I found out thet the variable suggested in a previous post is incorrect.
ANDROID_STUDIO_JDK is no good.
STUDIO_JDK is the one.
Also, just to make the things/solution worst to corner,
I've uninstalled jre and jdk then reinstall jdk only.
The setup variables are like this:
JAVA_HOME is now pointing to C:\Program Files\Java\jdk1.8.0_172\bin
JDK_HOME is pointing to C:\Program Files\Java\jdk1.8.0_172
STUDIO_JDK is pointing to C:\Program Files\Java\jdk1.8.0_172
It's a mess but it's working...
Is it because I uninstalled/reinstalled java sdk and jre? or just the env. variables? who knows :)
Specs:
i5 with 4gig ram
win 10 32bit
In addition to following the steps pointed out by Tigris I also had to run the Android Studio with Administrative rights. Not sure why but I just made it in a few minutes ago.
Follow the steps here: http://tools.android.com/knownissues#as0.1
Run Android Studio as Admin
There is Another Issue
http://tools.android.com/knownissues
open a "cmd.exe" (command prompt), cd to the android-studio\bin folder and run "studio.bat". You will most likely see an error: for example b/55267 is about the option -XX:+UseCodeCacheFlushing not being recognized. Report the error, remove the line from the studio.exe.vmoptions or studio64.exe.vmoptions and it should now work.
There could be a process still running in the background that would need to be killed in the task manager. The name of the process is studio64.exe (at least that's the name on my machine). Could be because I am running a 64-bit OS. After killing this process, try to run Android Studio again, and it should work.
If your path and/or environment variables are not pointing to the correct JDK, things won't work properly.
A rock solid solution, especially if you must have multiple JDKs installed (e.g. Java 6/7/8) is to create a batch file to launch Android Studio.
Create a new file called studio.bat and place this somewhere outside the Android Studio installation, e.g.
c:\mydevstuff\launchers\studio.bat
(if you put the batch file anywhere in the android-studio folder, then you'll have problems when updating Android Studio).
Put the following code in the new batch file:
#echo off
REM Can make paths relative to SCRIPT_PATH if necessary
set SCRIPT_PATH=%~dp0
set ANDROID_STUDIO_JDK=<JDK Path>
set JAVA_HOME=<JDK Path>
set PATH=<JDK Path>\bin;%PATH%
cd <android-studio Install Path>\bin
start studio64.exe
Replace studio64.exe with studio.exe if you need the 32-bit version.
Replace
<JDK Path>
with the path to your JDK, e.g.
C:\Program Files\Java\jdk1.7.0_25
Replace
<android-studio Install Path>
with the path to your Android Studio installation, e.g.
C:\Program Files\Android\android-studio
Now you can just run the batch file to start Android Studio.
Additional:
If you want to pin to the Taskbar, then create a shortcut to the batch file and then change it's target to:
cmd.exe /c "<path to bat>\studio.bat"
Then pin this shortcut to the Taskbar by drag-and-drop.
You can also set it's icon from the original Android Studio studio.exe file.
I ran into this problem and these steps fixed it.
Remove ALL older JRE / JDK versions
Set values for JDK_HOME & JAVA_HOME to path of JDK install
if you use android studio version 2.3.3 you should have JDK with version 1.8 in the system environment values ,
to add it
click on Computer (in windows 7)
System properties
Advanced system settings (at the right)
Advanced (tab)
environment variables button
and edit the value of name JAVA_HOME to the file which contains jdk 1.8
if you don't have this variable make a new one

Resources