Skip to content

Instantly share code, notes, and snippets.

@Mirochiu
Created December 11, 2020 02:35
Show Gist options
  • Save Mirochiu/f19f6ee875580d435152637de7634acb to your computer and use it in GitHub Desktop.
Save Mirochiu/f19f6ee875580d435152637de7634acb to your computer and use it in GitHub Desktop.
fix monkeyrunner not run in windows command prompt
Assume that the android sdk path in your windows system is C:\Users\%USERNAME%\AppData\Local\Android\Sdk
1. fix monkeyrunner not found
add below directory to your system path
C:\Users\%USERNAME%\AppData\Local\Android\Sdk\tools\bin
2. fix SWT folder not found
open command line with system admin permission, and enter the command below
setx -m ANDROID_SWT "C:\Users\%USERNAME%\AppData\Local\Android\Sdk\tools\lib\x86_64"
3. fix jarfile variable
edit monkeyrunner.bat under C:\Users\%USERNAME%\AppData\Local\Android\Sdk\tools\bin
if not exist %frameworkdir%\%jarfile% set jarfile=..\lib\monkeyrunner-26.0.0-dev.jar
add the command above after below commands
if exist %frameworkdir%\%jarfile% goto JarFileOk
set frameworkdir=..\framework
4. fix adb.exe not found
replace the command below
call "%java_exe%" -Xmx512m "-Djava.ext.dirs=%frameworkdir%;%swt_path%" -Dcom.android.monkeyrunner.bindir=..\framework -jar %jarpath% %*
with the command below
set bind_dir=..\framework
if not exist %bind_dir% set bind_dir=..\..\platform-tools
call "%java_exe%" -Xmx512m "-Djava.ext.dirs=%frameworkdir%;%swt_path%" -Dcom.android.monkeyrunner.bindir=%bind_dir% -jar %jarpath% %*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment