Related
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.
Recently I have installed the last version of Android Studio (Android Studio 2.1), keeping the old 1.2 version previously installed. Now i have Android Studio 2.1 and Android Studio 1.2. In Android Studio 1.2 when I click on SDK Manager it works properly, but in Andorid Studio 2.1 this problem appears:
how can I fix keeping the two versions of Android studio? Thanks
As the warning message states, the SDK location should not contain whitespace.
Your SDK is at C:\Users\Giacomo B\AppData\Local\Android\sdk. There is a whitespace character in Giacomo B.
The easiest solution is to move the SDK somewhere else, where there is no space or other whitespace character in the path, such as C:\Android\sdk. You can point both Android Studio installations to the new location.
There is another way:
Open up CMD (as Administrator)
Type: mklink /J C:\Program-Files "C:\Program Files" (Or in my case mklink /J C:\Program-Files-(x86) "C:\Program Files (x86)")
Hit enter
Magic happens! (Check your C drive)
Now you can point to C:\Program-Files (C:\Program-Files-(x86)).
just change the path:
"c:\program files\android\sdk" to "c:\progra~1\android\sdk"
or
"c:\program files (x86)\android\sdk" to "c:\progra~2\android\sdk"
note that the paths should not contain spaces.
It is possible to make a symbolic link from e.g. C:\Android\sdk to the actual location of the sdk (which contains whitespaces), and refer to this symbolic link from within Android Studio as the location of the SDK. I have, however, not tried whether NDK will work with such a setup, even though Android Studio stops giving this warning about whitespaces.
As long as you aren't using the NDK you can just ignore that warning.
By the way: This warning has nothing to do with parallel installations.
Simply....If you are not using NDK, there is no problem at all. On the other this is just warning not an error. With warning you can go ahead but not errors. Any it's better to adjust the whitespaces.
E.g if your SDK is at C:\program file\Android studio. There is a whitespaces "program file".
There are 2 simple methods:
1. Remove the whitespaces
2. Install at another location which don't have whitespaces.
I have the same error, make some change in the path C:\Users\Juan Jose\App---- to
C:\Users\JUAN~1\App.
CMD Command (Windows) go to root c:\Users
Type de command DIR /X
Here show a Short name of Juan Jose
Reemplace the name Juan Jose with the Short Name give it.
Copy your SDK folder and paste it in another folder without spaces (for example: "D: / Android / Sdk"), then open the SDK Manager, and change the Android SDK Location to the location of your new SDK folder
Just change
C:\Users\Giacomo B\AppData\Local\Android\sdk
to
C:\Users\Giacomo_B\AppData\Local\Android\sdk
I just wanted to add a solution for Mac users since this is the top article that comes up for searches related to this issue. If you have macOS 10.13 or later you can make use of APFS Space Sharing.
Open Disk Utility
Click Partition
Click Add Volume -- no need to Partition as we are adding an APFS volume which shares space within the current partition/container)
Give the volume a name (without spaces)
Click Add
You can now mount this drive like any other via Terminal: cd /Volumes/<your_volume_name>
Create an empty folder in the new volume -- I called mine sdk
You can now select the volume and directory while installing Android Studio
your sdk file path does not have whitespace like this./abc aaa/sdk it like ./abc_aaa/sdk this.
you know that this is does not do anything with your java and xml. It only affect the ndk which is for native apps or to use c++/c. so if you are just using java and xml or even kotlin there is no side effect with that thing
Just remove white space of all folders present in the given path for example Program Files
You can remove it by following steps->
Open elevated cmd,
In the command prompt execute:
mklink /J C:\Program-Files "C:\Program Files"
This will remove space and replace it with "-".
Better do this with both sdk and jdk path.
This works :)
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...
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
I've set up the Android SDK and Eclipse on my machine running Windows XP and AVDs (Android Virtual Devices) are saved to "Documents and Settings\user\.android" by default. Is there any way to change this behavior? I have all of the other components saved in a directory on a separate partition and would like everything to be consolidated. Obviously not a huge deal but does anyone here know a workaround for this?
Add a new user environment variable (Windows 7):
Start Menu > Control Panel > System > Advanced System Settings (on the left) > Environment Variables
Add a new user variable (at the top) that points your home user directory:
Variable name: ANDROID_SDK_HOME Variable value:
a path to a directory of your choice
AVD Manager will use this directory to save its .android directory into it.
For those who may be interested, I blogged about my first foray into Android development...
Android "Hello World": a Tale of Woe
Alternatively, you can use the Rapid Environment Editor to set the environment variables.
Based on official documentation https://developer.android.com/studio/command-line/variables.html you should change ANDROID_AVD_HOME environment var:
Emulator Environment Variables
By default, the emulator stores configuration files under
$HOME/.android/ and AVD data under $HOME/.android/avd/. You can
override the defaults by setting the following environment variables.
The emulator -avd command searches the avd directory in the
order of the values in $ANDROID_AVD_HOME,
$ANDROID_SDK_HOME/.android/avd/, and $HOME/.android/avd/. For emulator
environment variable help, type emulator -help-environment at the
command line. For information about emulator command-line options, see
Control the Emulator from the Command Line.
ANDROID_EMULATOR_HOME: Sets the path to the user-specific emulator configuration directory. The default location is
$ANDROID_SDK_HOME/.android/.
ANDROID_AVD_HOME: Sets the path to the directory that contains all AVD-specific files, which mostly consist of very large
disk images. The default location is $ANDROID_EMULATOR_HOME/avd/.
You might want to specify a new location if the default location is
low on disk space.
After change or set ANDROID_AVD_HOME you will have to move all content inside ~user/.android/avd/ to your new location and change path into ini file of each emulator, just replace it with your new path
Modify the file "virtual_android2.2.ini" in "C:\Documents and Settings{your windows login}.android\avd\":
target=android-8
path=E:\android_workspace\avd\virtual_android2.2.avd
And move the folder "virtual_android2.2.avd" from "C:\Documents and Settings{your windows login}.android\avd\" into "E:\android_workspace\avd\".
Move your .android to wherever you want it to.
Then, create a symlink like this:
# In your home folder
$ ln -s /path/to/.android/ .
This simply tells Linux that whenever the path ~/.android is referenced by any application, link it to /path/to/.android.
Go to the Android tools directory. Edit the android.bat command file. At about the end of the command file, find a line similar to
call %java_exe% -Djava.ext.dirs=%java_ext_dirs% -Dcom.android.sdkmanager.toolsdir="%tools_dir%" -Dcom.android.sdkmanager.workdir="%work_dir%" -jar %jar_path% %*
and replace
call %java_exe%
with
call %java_exe% -Duser.home={your_prefer_dir}
where {your_prefer_dire} is your preferred directory without braces but add doublequotes,
e.g.
call %java_exe% -Duser.home="E:\Program Files (x86)\android-sdk-windows"
For Visual Studio 2017 on Windows 10
Copy C:\Users\YOURUSERNAME\.android folder to (for example) E:\avd
Open the environment variables window:
Go into Settings and click on System.
On the left, click About and select System info at the
bottom.
In the new window, click Advanced system
settings on the left.
Click Environment Variables at
the bottom of the resulting window.
Add a new variable:
Variable name: ANDROID_SDK_HOME
Variable value: a path to a directory (e.g E:\avd)
Don't include .android in the variable value.
Restart Visual Studio.
For change SDK & NDK location go to:
Tools -> Options -> Xamarin -> Android Setting
You can change the .ini file for the new AVD:
target=android-7
path=C:\Users\username\.android\avd\VIRTUAL_DEVICE_NAME.avd
I don't know how to specify where the .ini file should be stored :)
In Windows 10 I had that problem because My C Drive was getting full and I had needed free Space, AVD folder had 14 gig space so I needed to move that folder to another driver, first answer not work for Me so I tested another way to fix it this problem,
I make a picture for you if you have the same problem, you don't need to move all of the files in .android folder to another drive (this way not work) just move avd folders in ....android\avd to another drive and open .ini files and change avd folder path from that file to the new path.
Like this image:
I hope this works for you.
Note: careful about a separate character before and after the path in ini file that you cannot see,if you remove that character it's not works
Check this out.
using the android command to create avd you can specify where to place files.
-p --path Location path of the directory where the new AVD will be created
The environmental variable ANDROID_AVD_HOME can be used to define the directory in which the AVD Manager shall look for AVD INI files and can therefore be used to change the location of the virtual devices;
The default value is %USERPROFILE%\.android\avd on Windows (or ~/.android/avd on Linux).
One can also create a link for the whole directory %USERPROFILE%\.android on Windows (or a sym-link for directory ~/.android on Linux).
When moving AVDs, the path entry in AVD INI file needs to be updated accordingly.
Another way to specify ANDROID_SDK_HOME without messing around with environment variables (especially when using ec2) is simply create a shortcut of eclipse and add the following as target
C:\Windows\System32\cmd.exe /C "setx ANDROID_SDK_HOME YOUR AVD PATH /M & YOUR ECLIPSE.EXE PATH"
This will set ANDROID_SDK_HOME as system variable whenever you launch eclipse.
HTH
Paul
Please take note of the following : modifying android.bat in the Android tools directory, as suggested in a previous answer, may lead to problems.
If you do so, in order to legitimately have your .android directory located to a non-default location then there may be an inconsistency between the AVDs listed by Android Studio (using "Tools > Android > AVD Manager") and the AVDs listed by sdk command line tool "android avd".
I suppose that Android Studio, with its internal AVD Manager, does not use the android.bat modified path ; it relies on the ANDROID_SDK_HOME variable to locate AVDs.
My own tests have shown that Android tools correctly use the ANDROID_SDK_HOME variable.
Therefore, there is no point, as far as I know, in modifying android.bat, and using the environment variable should be preferred.
there are major 4 steps
1. copy the .android folder to your desired location as i did in D:\Android\.android
2. set ANDROID_AVD_HOME in environment variables like ANDROID_AVD_HOME D:\Android\.android\avd
3. change avd name.ini file contents with new location like
avd.ini.encoding=UTF-8
path=D:\Android\.android\avd\Pixel_2_API_29.avd
path.rel=avd\Pixel_2_API_29.avd
target=android-29
4. restart android studio
1 - Move AVD to new Folder
2 - start Menu > Control Panel > System > Advanced System Settings (on the left) > Environment Variables
Add a new user variable:
Variable name: ANDROID_AVD_HOME
Variable value: a path to a directory of your choice
3 - Change the file .INI Set new folder.
4 - Open Android Studio
WORKS - Windows 2010
MORE INSTRUCTIONS : https://developer.android.com/studio/command-line/variables
In my case, what I concerned about is the C: drive disk space.
So what I did is copy the ".avd" folder(not file) to other drive, and leave the ".ini" file there but change it to point to the moved
I think the easiest way is to move the avd folder from C:\Users[USER].android folder to your desired location then create a symbolic link to it in C:\Users[USER].android with the same name.
If you wonder how to do this, first install Link Shell Extension. After folder movement right click on it and select Pick Link Source then right click in .android folder and in Drop As... sub menu select Symbolic Link.
I followed https://www.mysysadmintips.com/windows/clients/761-move-android-studio-avd-folder-to-a-new-location.
Start copying a folder "C:\Users\user\.android\avd" to "D:\Android\.android\avd" (or something else).
Close Android Studio and running emulators.
Press Win + Break and open Advanced System Settings. Then press Environment Variables. Add a user variable ANDROID_SDK_HOME. (I didn't experiment with ANDROID_AVD_HOME.) In Variable value field write D:\Android. If you also moved SDK to another folder, change ANDROID_HOME (I forgot to change it and some emulators didn't launch, see https://stackoverflow.com/a/57408085/2914140).
Wait until the folder will finish copying and start Android Studio.
Open Android Virtual Device Manager and see a list of emulators. If you don't see emulators and they existed, then probably you entered wrong path into user variable value in step 3. In this case close AS, change the variable and open AS again.
Start any emulator. It will try to restore it's state, but it sometimes fails. A black screen can appear instead of Android wallpaper.
In this case you can:
a. Restart your emulator. To do this close running emulator, then in AVD Manager click Cold Boot Now.
b. If this didn't help, open emulator settings, found in file "D:\Android\.android\avd\Pixel_API_27.ini".
Change a path to a new AVD folder. Restart the emulator.
Delete old AVD folder from "C:\Users\user\.android\avd".
For Windows 10 :
ANDROID_SDK_HOME
this link helped me.
Then just moved all content of "avd" to the new location. Now you may need to change the value of "path=" in the configuration Setting file of each avds to the new location. You can see the old avds in avd manager in Android Studio and they work.
ANDROID_SDK_HOME also worked for me on Windows 8 x64
also find all location (in my case it was d:\.android) and delete it. You won't need it anymore.
In AVD manager, after setting up AVD using a target with Google APIs, on run was getting error.
Detail showed: "AVD Unknown target 'Google Inc.:Google APIs:...... "
During install (on Win7 system) I had chosen a SDK directory location, instead of accepting C:\Users\...
I'd then added that directory to environment variable 'path'
Command line: android list targets did show a couple of Google apis.
Setting ANDROID_SDK_HOME to my install path fixed the avd run error.
Variable name: ANDROID_SDK_HOME
Variable value: C:\Users>User Name
worked for me.
MacOs
Get a directory adv
./emulator -help-datadir
the default directory is:
/Users/{your_computer_user_name}/.android
and then Go to avd Folder edit .ini file with path to your custom emulator directory
example :
path=/Volumes/Macintos/_emulatorandroid/avd/Nexus_5X_API_27.avd
path.rel=avd/Nexus_5X_API_27.avd
target=android-27
and then save. Now your Emulator haschange
And Result: