Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CreateProcess error=2, The system cannot find the file specified [Android studio]

I upgraded my windows and reinstalled Android studio 0.3.2. I am using windows8.1 Pro now and installed java x64, I also did set up JAVA_HOME EV to C:\Program Files\Java\jdk1.7.0_45 and Android studio is installed in D:\Android Stutio\

When I try to run my project I get the Following Error

Cannot run program "C:\Program Files (x86)\Java\jdk1.7.0_40\bin\java" (in directory "D:\Android Stutio\system\compile-server"): CreateProcess error=2, The system cannot find the file specified

Android studio is installed in D:\Android Stutio\

How to fix this one

like image 630
dmSherazi Avatar asked Nov 09 '13 09:11

dmSherazi


4 Answers

Since android studio is still referring to jdk1.7.0_40 change its path

  1. Goto Files->Other Settings->Default Project Structure.

  2. Under Platform Settings Select Android sdk...under JDK location change C:\Program Files (x86)\Java\jdk1.7.0_40 to C:\Program Files\Java\jdk1.7.0_45

That should do the trick :)

like image 113
user3235168 Avatar answered Oct 21 '22 06:10

user3235168


Try the following: Open a new commandline (Win+R => cmd.exe) and enter "java". I predict that you'll get an error that says something like "command not found". The reason for this is that you don't have an windows environment variable set for your java.exe.

Do so by Win+X => System => Advanced System Settings => Advanced => Environment variables => search for PATH under the system variables => edit => append the path to your java.exe sperarated by ;

For example: ../other/pathes/with/file.exe;C:\Program Files (x86)\Java\jdk1.6.0_45\bin

Save,close,restart

like image 44
muetzenflo Avatar answered Oct 21 '22 05:10

muetzenflo


I got this same error on android studio 3.1 which I've just now updated. user3235168's answer worked for me.

Additionally I had to remove the check mark from 'Use embedded JDK(recommended)' Then browse to jdk's path - C:\Program Files\Java\jdk1.8.0_144

like image 45
Abu Sufian Avatar answered Oct 21 '22 06:10

Abu Sufian


I hope this answer can be a reference for new comer!

I got same issue and I stuck for this error!

Finally I got solution here!

After I explore the error detail, I got message that there are issue with NDK. Try to disable NDK or add the following code in your gradle.build

packagingOptions{
    doNotStrip '*/mips/*.so'
    doNotStrip '*/mips64/*.so'
}
like image 21
Ajie Kurniyawan Avatar answered Oct 21 '22 05:10

Ajie Kurniyawan