NOTE 1 : During the duration of this tutorial, please open every file is mentioned in the guide ‘as an Administrator’.
NOTE 2 : If one solution doesn’t work for you, just keep on moving to the next solution until you get it working. If you do manage to fix it, please comment down below saying the same and mentioning the solution number that worked for you. Conversely, if none of the solutions work for you, please mention the error you are getting in the console.
2. The Second way is through android.bat file present in the downloaded Android SDK folder itself.
- Open the [android-sdk-folder]/tools folder where the ‘android-sdk-folder’ for me is ‘C:/android-sdk-windows‘ so the path becomes: ‘C:/android-sdk-windows/tools‘. In that particular folder, there is an ‘android.bat’ file as shown in the screenshot below. Double clicking it opens Android SDK as well.
The first and foremost thing that you should try if you haven’t already is to try to open Android SDK from Eclipse and android.bat (as explained above) by opening these respective files ‘as an Administrator’. As simple as it may be, it has worked out for many and hence definitely worth a try.
The second most common solution to this problem is deleting the ‘.android’ folder and then to try to open the Android SDK folder by both the methods described above in ‘Accessing Android SDK’ section. How?
- Go to My Computer > Users > [your-username]. Where the username for my case would be ‘com’ so the path becomes ‘C:/Users/com‘
- Find the ‘.android’ folder which is usually on the top. Copy and make a backup of it in somewhere else and delete this one.
- Once deleted, fire up Android SDK from Eclipse or android.bat file (as explained above).
- Go to android.bat file from the [android-sdk-folder]/tools folder where the android-sdk-folder for me is ‘C:/android-sdk-windows‘ so the path becomes: ‘C:/android-sdk-windows/tools‘. In that particular folder, there is an ‘android.bat’ file as shown in the screenshot below.
- Now edit the line “set java_exe=” line to include the path of JDK java executable file (java.exe) by setting the line as java_exe=C:/Program Files/Java/jdk1.7.0_75/bin/java.exe where “C:/Program Files/Java/jdk1.7.0_75/bin/java.exe” is the path to the java executable file for the installed JDK. So set it according to your directory path.
- If setting the JDK path doesn’t work, enclose the path in double quotes (“”) and try again. If it still doesn’t work, try to set the path to JRE, java.exe file and try again with and without the enclosing double quotes. The line in each of those cases would look like:
- Save the file and hit close. Test it out in Eclipse by going to Window > Android SDK Manager or by opening the ‘android.bat’ file as explained above in the accessing SDK section.
- If it still doesn’t work, you should be getting an error similar to this. Fret not, move on to the next solution.
- First of all remove all pre-existing versions of java (JDK and JRE) from your system by uninstalling them from the remove programs section in control panel.
- Download JDK 1.7.x.x version from the Oracle Java download website. It’s very important to download specifically the version 1.7.x.x of JDK because as it turns out that Android SDK does not support JDK 8 as of now. Download either the 32bit or 64bit depending on whether your system is 32 bit or 64bit. To find out which bit version of windows you are running, refer to this guide.
- Now we need to set the path to the new JDK and JRE in the environment variables. So go to Start > Right-click on My Computer > Properties > Advanced System Settings > Environment Variables
- Find the PATH variable under system variables tab and press edit. Now add the path directory to the bin folder of JDK and JRE at the end like this: C:/Program Files/Java/jre1.8.0_40/bin;C:/Program Files/Java/jdk1.7.0_75/bin; (Don’t forget to keep the semicolon at the end)
- Now once that’s done, click ‘New’ to create a new variable. Set the Variable name to ‘JAVA_HOME’ and the variable value to the path to the bin folder of JDK which would be C:/Program Files/Java/jdk1.7.0_75/bin for my case.
- Now perform the exact same steps as mentioned in SOLUTION 2 i.e going to My Computer > Users > [your-username] directory and deleting the ‘.android‘ folder after making a backup of the same folder elsewhere.
- Now as explained in the ‘Accessing Android SDK’ section above, go to the [sdk-tools]/tools directory which for me is C:/android-sdk-windows/tools.
- Find the ‘android.bat’ file, Right-click on it and select ‘Edit’ to open the file contents in notepad. Now make the following changes:
set java_exe= call libfind_java.bat if not defined java_exe goto :EOF
set java_exe=C:Program FilesJavajdk1.7.0_75binjava.exe rem call libfind_java.bat rem if not defined java_exe goto :EOF
for /f "delims=" %%a in ('"%java_exe%" -jar libarchquery.jar') do set swt_path=lib%%a
rem for /f "delims=" %%a in ('"%java_exe%" -jar libarchquery.jar') do set swt_path=lib%%a set swt_path=libx86_64
swt_path=libx86_64otherwise if it is 32bit then keep it as set
- Hit Save and close the file. Now go to Eclipse > Windows > Android SDK. The SDK manager should fire up in a few seconds. Enjoy!