Cannot find 'emulator.exe' when trying to test apps - android

I'm working with KonyOne Studio to build and test apps. The Android SDK is located in C:\Android\adt-bundle-windows-x86_64-20130729\sdk and the emulator is located at C:\Android\adt-bundle-windows-x86_64-20130729\sdk\tools\emulator.exe. When I try to run apps, I get the error:
Windows cannot find 'emulator.exe'. Make sure you typed the name
correctly, and then try again.
When I just run the emulator.exe executable, I get a quick cmd screen and it disappears as quick as it appeared. Nothing shows up in my task manager.
I've set the following environment variables:
JAVA_HOME: C:\Java\jdk1.6.0_32
PATH: C:\Java\jdk1.6.0_32;D:\Users\SIMONSJP.GROUPINFRA\AppData\Roaming\npm;
C:\KonyOne\ImageMagick;C:\apache-ant-1.9.2\bin;C:\Java\jdk1.6.0_32\bin;
C:\Android\adt-bundle-windows-x86_64-20130729\sdk\platform-tools;
Ofcourse the above is without spaces. I don't understand why the emulator doesn't run. Can anyone figure out why it isn't working?

Your path variable only includes platform-tools. It needs to include the path to the emulator too.
Two ways:
Copy the emulator.exe to platform-tools
add the tools folder to path variable.

Extract your sdk zip at some other place, copy tools directory, replace it with your actual sdk tools folder contents.
Restart eclipse if required...
This worked for me.Hope same happens with you too...

Related

Uiautomatorviewer is giving error "SWT folder '..\lib\location of your Java installation.' does not exist"

I have installed Android studio V 3.1.1
i am trying to launch UIautoamtorviewer.bat file from
C:\Users\panmishr\AppData\Local\Android\Sdk\tools\bin
however it always gives me error
SWT folder '..\framework\location of your Java installation.' does not exist.Please set ANDROID_SWT to point to the folder containing swt.jar for your platform.
below are list of env variables , which i have set
ANDROID_HOME: C:\Users\panmishr\AppData\Local\Android\Sdk
ANDROID_SWT:C:\Users\panmishr\AppData\Local\Android\Sdk\tools\lib\x86_64
JAVA_HOME :C:\Program Files\Java\jdk1.8.0_171
in Path Variable , i have included
C:\Users\panmishr\App;C:\Users\panmishr\AppData\Local\Android\Sdk\tools
C:\Users\panmishr\AppData\Local\Android\Sdk\platform-tools
My machine is 64 bit windows 7 .
Let me know, what i have missed.
I was able to resolve this with the help of sdkmanager.bat
Go to bin folder
C:\Users\panmishr\AppData\Local\Android\Sdk\tools\bin
run
`**sdkmanager.bat**`
it will give the correct error, like in my case JAVA_HOME path was
Set to old path in registry.
Run regedit
Search JAVA_HOME
Delete the old JAVA_HOME key and value.
log off the machine
run uiautomatorviewer.bat
This time it worked!!
In my case, I had the same problem because I was changed my JVM and I didnĀ“t restart the PC afther that. So the only think that I did was restart the computer and all the regedit files was update
I was able to fix the problem with below Steps:
set ANDROID_SWT = "C:\Users\xxxx\AppData\Local\Android\Sdk\tools\lib\x86_64"
{ The mentioned location is where swt.jar is located.}
Open CMD -> run uiautomatorviewer
It works !!
From my research Uiautomatorviewer works only with the version Java 8. So any version above 8 will not work. I had Java 17 installed and had to uninstall it.
You can download the the previous version of Java at this link from the official Oracle website:
https://www.oracle.com/java/technologies/javase/javase8u211-later-archive-downloads.html
Download the x86 version relative to you operating system. (For example I am using a Windows and downloaded: jdk-8u291-windows-i586.exe)
Now you have to configure the environment variables for "JAVA_PATH". To access this on Windows click on file explorer, right click, and select "properties".
On the right side of the windows form, select "Advanced system settings."
Click "Environment Variables" near the lower right corner of the window.
At this screen set "JAVA_HOME" to "C:\Program Files (x86)\Java\jdk1.8.0_291" as shown in the screenshot below.
From here, restart the computer and go the cmd and enter uiautomatorviewer.
This fixed the issue for me. Be sure to have your emulator turned on and remember to shut off the appium server when you are taking a screenshot of the emulator.

Can't get Android SDK Manager to open

Having searched here and elsewhere for answers to my problems, I'm still unable to fix this.
I've installed Eclipse, ADT Plugin, and the Android SDK. My problem is that the SDK Manager won't open, whether it is launched from Eclipse or directly. The command prompt window flashes up briefly, then closes.
I've tried several proposed solutions: Various configurations of my Path and JAVA_HOME variables, installation of the 32 and 64 bit versions of the JDK, running as Administrator, all with no success.
The different components are installed at these paths:
JDK - C:\Program Files\Java\jdk1.7.0_11
JRE - C:\Program Files\Java\jre7
SDK - C:\ADT\sdk
My JAVA_HOME is set to C:\Program Files\Java\jdk1.7.0_11
My Path includes C:\Program Files\Java\jdk1.7.0_11\bin at the beginning.
I've tried reinstalling the SDK and the installer correctly identifies the location of Java, and yet still it won't work.
Can anyone help me out with this? I'm practically tearing my hair out!
Open cmd,
go to android sdk folder,
in tools/lib/, edit find_java.bat,
you will see the lines like below, add black line to your file and save.
rem Check we have a valid Java.exe in the path. The return code will
rem be 0 if the command worked or 1 if the exec failed (program not
found). for /f %%a in ('%~dps0\find_java.exe -t') do set java_exe=%%a
this
set java_exe="C:\Program Files\Java\jdk1.7.0_11\bin\java.exe"
if not defined java_exe goto :CheckFailed
:SearchJavaW
rem Check if we can find a javaw.exe at the same location
than java.exe. rem If that doesn't work, just fall back on the
java.exe we just found. for /f %%a in ('%~dps0\find_java.exe -t -w')
do set javaw_exe=%%a if not exist %javaw_exe% set javaw_exe=%java_exe%
set javaw_exe="C:\Program Files\Java\jdk1.7.0_11\bin\java.exe"
i hope it helps
Answer by Talha is correct. Just adding that you might need to NOT include quotation marks in the black lines in his solution.
The following addition worked for me:
set java_exe=C:\Program Files\Java\jdk1.7.0_11\bin\java.exe
Found out what the cause of this problem was in my case: In the registry, there was a setting to have the CMD using UTF-8 (chcp=65001).
If I double click C:\Programmer\Android\SDK Manager.exe, I get the described symptoms.
If double click C:\Programmer\Android\sdk\tools\lib\SDK Manager.exe there is a hint:
A pop-up stating: Failed to execute tools\android.bat
Starting a CMD window in C:\Programmer\Android\sdk\tools and running android.bat, gave no output, even if editing the file and reming out the initial #echo off. Running the command chcp returned 65001.
So changing the codepage with chcp 850 and then running android.bat again, I got output, ending with the line: call lib\find_java.bat. This turned out to be the same problem. Each time a new CMD was spawned, the codepage changed to 65001
Fixed the problem by editing the following registry entry, deleting the value, and everything worked:
HKEY_LOCAL_MACHINE->SOFTWARE->Microsoft->Command Processor->AutoRun: #chcp 65001>nul
Having an empty value here, make the CMD using codepage 850, and the bat files begin to work again.
I am not quite sure what has made this change in the first place, but now I know the cure.
When extracting the adt-bundle-windows-x86_64-20131030.zip, three files were broken:
("sdk/tools/lib/httpcore-4.1.jar","sdk/tools/lib/find_java.exe","sdk/tools/lib/sdk-common.jar")
I don't know why but you can replace these files using old versions of android SDK e.g. android-sdktools_installer_r20.0.1-windows.exe. It worked for me.
After much searching.......and installing...re-intalling.....and changing the path of the android.bat as the answers above mentioned.....the final solution was: running Eclipse or the bat file or Android studio as administrator in windows 8 for the manager to open up!
check the md5 checksum for eclipse and android SDK.It might be an md5 check sum problem.
for calculating the md5 checksum of files u downloaded you can go to http://www.guidingtech.com/9800/what-is-md5-checksum-how-to-verify-it/
for correct md5 checksum :-
1. for eclipse go to link their official download site click on
downloaded package that u downloaded then go to check sum just match it with ur eclipse downloaded file.
2.for android sdk go to http://developer.android.com/sdk/index.html and click on download for other platformsand match the md5 checksum (f09aa4557bd1dc2703fde95dcdd6b92e).
i my case i downloaded all that stuff four times.
with regards
ajay
This could also happen if you haven't installed Java on your machine. I had a similar problem but after installing java it worked for me. You can download Java from https://www.java.com/en/download/help/download_options.xml.
Regards,
Abhi
Follow these steps and it help for me after a long time with all ways above not effect on windows7 64-bits, no need to have JAVA_HOME system variable or edit android.bat
Download Android Studio within Android SDK, Java JDK 64 bits and Java JRE x86
Install Java JRE first, then install Java JDK 64 bits, and the Android Studio last.
Now you start Android Studio first (64 bits version) it require to have JAVA_HOME setting to run JVM, just copy the jdk.x.x.x(version) folder (my PC: jdk1.8.0_25 from "C:\Program Files\Java\")folder to Android Studio folder and rename that folder (in Android Studio) to "jre" (jdk1.8.0_25 -> jre).
Now it work for me to open Android SDK Manager from anywhere, if you want to use eclipse (not official now) just copy the java jre.x.x.x(version) x86 folder (from where you install before) to Eclipse and rename to "jre". After coping, choose the Android SDK path in Eclipse to use, It works for both Android Studio and Eclipse.
Mind your antivirus if still refusing you (remove antivirus and install after you sure it not cause problem)!
cmd this "android.bat update sdk" ,this way can open "SDK Manager.exe"
note
1."D:\SDK\android-sdk-windows\tools" PATH in enviroment.
2.Replace sdk "tools" folder, this is site -> https://developer.android.com/studio/index.html, then select "Get just the command line tools".(new version deprecated "SDK Manager.exe")
this way worked for my Android Studio 2.3
3.and if "android.bat update sdk" can't work, see this video-> https://www.youtube.com/watch?v=FMLVY3PqPlc
I have tried all the above methods none of them worked.If you have already installed jdk-10 or any other then uninstall it and install jdk-8. If you created the path variables then immediately remove the 'JAVA_HOME' variable and also remove the java path from 'PATH' variable. Then install the jdk-8, and try to install sdk manager it works perfectly.
I found another solution, assuming you have Android Studio installed on your system:
Open Android Studio
Open settings (Control + Alt + S)
Locate "Android SDK" setting (Appearance & Behavior -> System Settings)
On the right side, you'll have the SDK related tabs
Try This >
Go to sdk folder
Right Click on Sdk Manager then Run as A administrator .
It will open sdk manger and your problem will solve

Updating Android SDK: "A folder failed to be moved."

While trying to update my Android SDK I am encountering this error when trying to install this particular package:
How do I fix this?
This happens once in a while on my Windows SDK (even when I don't have any antivirus or similar programs running, execute the SDK-Manager as an administrator and so on).
I just update the tools by hand in this case. Which means close the SDK-Manager after the error and open the ANDROID_SDK\temp folder. There should be a zip named tools_R16.zip or similar (don't remember the exact name). Unzip that. You should end up with a tools folder. Copy all the files from this folder into ANDROID_SDK\tools. Overwrite when asked. And take a backup of the SDKs tools folder beforehand, just in case something explodes.
After that, start the SDK-Manager again. The tools version should be updated.
The problem seems to be that Eclipse, or even the SDK Manager itself, locks the folder. Running android.bat from the tools folder should do the trick.
If you launched the SDK Manager from Android Studio then all you need to do is close Android Studio.
I presumed the SDK Manager was a modal dialog that was part of Android Studio - not a separate program.
thanks. this is how I fixed it:
I updated the tools by hand in this case. Which means close the SDK-manager after the error and open the folder android-sdk-windows folder. Using LockHunter, unlock all programs from holding a lock on the android-sdk-windows\tools\ folder. http://lockhunter.com/?ver=&vertype=pro&sm=main_window_64
RENAME the android-sdk-windows\tools folder beforehand to tools_DELETEME
There should be a zip named android-sdk-windows\temp\tools_r19-windows.zip. open that, You should see a tools folder in it. Copy that tools folder to android-sdk-windows\tools
After that, start the SDK-manager again. The tools version should be updated.
When you install tools/softwares use SDK manager. But don't use it when update. Do right click -> Run as administrator on android-sdk-windows\tools\android.bat file for updating tools. Always try to run commands as Administrator specially on Windows Vista/7/8. That'll fix most of permission issues etc...
You probably started the SDK manager from eclipse? I encoutnered the same problem, and fixed it by manually opening the SDK manager from the directy tools.
My solution was to start it from within eclipse - as Administrator.
well i had the same issue on windows 7 ... problem is that during the update it tries to rename the tools folder (inside the SDK folder) and that folder is used by a process "ADB" which is currently running ...
so you cannot do the update smoothly until you stop / kill that process ...
BTW copy pasting the new contents of tools folder from the temp would also work ...
With windows 7, when "failed to install popup" appears kill the process called adb (from task manager ctrl+alt+del) then press "Yes" and stuff is being installed.
I tried running android.bat and got the same error.
What worked for me was using unlocker to unlock the \tools folder.
Ensure you don't have any essential files or folder opened/being used by other applications including explorer.
I've read before, people take a copy of the platform-tools folder and run the update from a different location. This ensures you haven't got open the files it's trying to update.
Could also disable your antivirus for 5 minutes o0o0.
On Windows 7 and probably Vista, run Eclipse as administrator.
My problem was Windows 7 security. I opened up the security on C:\Program Files\Android to EVERYONE with FULL access and it then worked. I then removed EVERYONE after the update was complete.
I had to make a copy of the tools folder itself (keeping it at the same directory tree
level, thus "tools" and "tools-copy" were both in the "android-sdk-windows" folder).
Then ran Android.bat from that copy.
After the update just delete the tools-copy folder.
The error message was Failed to rename directory C:\devtools\android-sdk\system-images\android-21\google_apis\x86 to C:\devtools\android-sdk\temp\SystemImagePackage.old01. I deleted the C:\devtools\android-sdk\temp\SystemImagePackage.old01 directory by hand (it was a leftover? I don't know) and it was able to proceed.
Same error i got while updating sdk. It is because of targeted folder locked (access permission is denied).
You can resolve it as follows in "Ubuntu" :-
Press ALT + F2 and type 'gksudo nautilus' and navigate to the targeted folder like tools or extras and give create and delete permission.
then update, every thing will be working fine :)
First make a copy of tools folder in same directory (android-sdk or android-sdk-windows) then delete the original tools folder and then open the android.bat file by double clicking in tools-copy folder to launch sdk manager and install the tools.
If tools folder is not being deleted then use the unlocker LockHunter to delete the folder and then open android.bat to update the tools.
After successful installation of tools delete the tools-copy folder.
Close Eclipse or Android Studio if open.
It worked for me!!!
On my PC it was caused by monitor.exe running in the background. Terminating that proces solved the problem.
Close the currently launched android studio window from task manager by going to the studioprocess (So when closed there are currently no active studio windows). Then go to Android studio in windows explorer, select the studio64/studio(if 32 bit OS) and right click and select run as administrator.
In one line - you need to run Android Studio as a administrator.
These are the steps followed by me.
Restart the computer.
Open "C:\android\androidStudio\sdk\tools\android.bat" as admin.
Now install packages should run fine.
I know this is an old post but I want to write my personal solution to the problem:
Failed to rename directory C:\android-sdk\tools to C:\android-sdk\temp\ToolPackage.old01.
Obviously I have had the same issue and every time the Android tools needs to be updated it's a nightmare.
None of the solutions I found googling the net worked for me up now, but this is a vital job to maintain Android SDK updated. So I started to find an alternative working way to solve this issue and I found it finally.... at least... it works for me, even if it is a bit tricky.
The basic problem is that the android.bat batch file comes from the ~\tools\ folder and it's still in memory (running) while the same ~\tools\ folder needs to be updated (in our case, renamed).
The problem is that the android.bat runs java to launch swt.jar (the SDK tool), and it remains uselessly waiting for completion of this java program.
You can edit the android.bat and see the call in the latest row of this batch:
call "%java_exe% %REMOTE_DEBUG%" "-Dcom.android.sdkmanager.toolsdir=%tools_dir%" "-Dcom.android.sdkmanager.workdir=%work_dir%" -classpath "%jar_path%;%swt_path%\swt.jar" com.android.sdkmanager.Main %*
The problem is the "call" CMD command. It waits for the called external program completion.
But ther's another way to run external programs from a batch file: the "start" command. It launches an external program and terminates.
So I just replaced the "call" command with "start", so that after the change the latest row of my android.bat was:
start "" "%java_exe% %REMOTE_DEBUG%" "-Dcom.android.sdkmanager.toolsdir=%tools_dir%" "-Dcom.android.sdkmanager.workdir=%work_dir%" -classpath "%jar_path%;%swt_path%\swt.jar" com.android.sdkmanager.Main %*
Note: Keep the "" in between start and the application path. You can add text in those hyphens and this text will be the caption of the java.exe command window you will see after the changes. In my case I left the caption as an empty string but you can write there what you want.
After the changes, you can start the SDK and the android.bat will be no more waiting, leaving the SDK tool free to play (and rename the ~\tools\ folder without headaches).
Obviously, after updating the SDK tools, you have to redo the same changes in the new, updated android.bat batch file. This could be a bit unconfortable, but you'll have just to remember to make the changes before running the SDK tool and you'll have no other headaches while updating Android.
In Ubuntu following solved issue for me
cd [tools/directory/path]
sudo ./android
Solved this on my side by killing the adb.exe in Task Manager.
I just stopped the emulator, and problem was solved.

Starting the Android emulator in SDK tools, revision 12

I updated the Android SDK tools from revision 11 to revision 12, and the emulator now fails to start. When I try to run emulator.exe, I get:
invalid command-line parameter: Files\Android\android-sdk\tools/emulator-arm.exe.
Hint: use '#foo' to launch a virtual device named 'foo'.
please use -help for more information
The path to emulator.exe is C:\Program Files\Android\android-sdk\tools.
How do I fix it?
As was previously suggested, it does seem to be caused by the fact that there is a space in the default installation path of the Android SDK: C:\Program Files\Android\android-sdk\
There are a couple of possible solves, though-
move installation directories to paths that do not contains spaces (as already mentioned)...
but simpler and possibly slightly less cumbersome is simply adjusting the path in Eclipse to use 8-dot-3 directory name(s). Since I'm running Win7, I have two Program Files directories, the second one being "Program Files (x86)" which is where the sdk installed. So the 8-dot-3 path is PROGRA~2. Thus, I simply changed the "SDK Location" value in the Android Preferences in Eclipse from C:\Program Files\Android\android-sdk\ to C:\PROGRA~2\Android\android-sdk\ and everything now works fine.
If you don't know the 8-dot-3 name of your desired path, just fire up a Command Prompt and execute "DIR /X"... the short name will be displayed next to each directory.
Same problem for me, though this is my first time trying to work with Android SDK in general. I believe the problem is with the location of the SDK. Note the "paramater" "Files\Android\android-sdk\tools/emulator-arm.exe." I believe there is a bug in google's code where it doesn't have the directory the SDK is located in in quotes, meaning, if there is a space anywhere in the directory name, it won't work. Can someone with their SDK in a directory with no spaces confirm my theory?
To work around the issue, you can call "C:\Program Files\Android\android-sdk\tools\emulator #foo" from the command line, where "foo" is the name of your emulator.
I got this problem just now, and I found a solution.
My path to the emulator-arm.exe is C:\Program Files\Android\android-sdk\tools. When I try emulator-arm #my_avd from the command line (my_avd is my Android Virtual Device name), it works.
I fixed this problem on Windows XP. Just cut from "C:\Program Files\Android\android-sdk" and paste content directory to "C:\Android\android-sdk". Set my system varaible 'ANDROID_HOME'="C:\Android\android-sdk". Set path to Android SDK in Eclipse as "C:\Android\android-sdk". That's it!
Everything works fine.
Since the cause of this issue is the space within filepath names of the Windows install directory then another workaround is to use the file short names (i.e. 8.3 alias filenames).
Specifically, if root install directory for Android SDK is
c:\Program Files\.. then use c:\PROGRA~1\..
or if
c:\Program Files(x86)\.. then use c:\PROGRA~2\..
You can then launch the SDK Manager via the command-line by running:
start c:\PROGRA~2\Android\android-sdk\tools\android.bat
Fixed in r13. Update your SDK Tools!
I think you are saying you changed the minSDK version of your app and now the emulator wont run...? this is because your emulator is the wrong version... assuming you changed the minSDK of your app correctly, all you need to do is create a emulator with the same SDK version. Open the Android SDK / AVD manager (icon top right of screen next to print token) and create a emulator with minSDK 12.
Moving your Android SDK folder to somewhere that the complete path will be without white spaces will fix the problem.
I also got this problem after updating SDK Tools from revision 11 to 12.
I found it was a problem with a space in the upper directory name where android-sdk-windows resides, then I copied both 'eclipse' and 'android-sdk-windows' directories from my 'Program Files (x86)' to the root of drive D:.
All is solved now!
As an alternative to PROGRA~2 method (which is not working for example in Intellij IDEA), you can create a symlink named, for example, prg to Program Files (run mklink /? from command line to learn how to do it), then run emulator as C:\prg\Android\android-sdk\tools\emulator.exe. Change path to SDK/emulator in your IDE also.
I had a same problem when I setup r12. I found out this problem was caused by blank spaces in the path you setup android SDK. The solution is that you should move the folder of android SDK to a place without spaces, in your case : E:\andriod-sdk or D:\abc\xyz\android-sdk.

Building Android AVD

I can't seem to get my AVD built.
I got all the tools. I even have GIT, but when I try to do the command avd devices it will say: no such command.
You have to issue the adb command in the tools directory where you have installed Android.
For me it's
f:\android-sdk-windows-1.6_r1\tools\adb.exe
Add the tools directory in the SDK to your Windows PATH.
Control Panel/System/Advanced System Settings/Environment Variables, select PATH, click Edit..., and add ;c:\Program Files\android-sdk\tools (adjusted for wherever you actually installed the tools) to the end. If you want to make this change only for your current user, and there is no PATH in the User variables box, just add it as a new variable and leave out the semicolon.

Categories

Resources