MonkeyRunner cannot run on Git Shell. Receiving #echo: command not found - android

I am trying to run Android's MonkeyRunner but having problems running it from my Git Shell.
When I run:
monkeyrunner.bat
it gives me this error.
$ monkeyrunner.bat
/c/AndroidSDK/tools/monkeyrunner.bat: line 1: #echo: command not found
/c/AndroidSDK/tools/monkeyrunner.bat: line 2: syntax error near unexpected token `('
/c/AndroidSDK/tools/monkeyrunner.bat: line 2: `rem Copyright (C) 2010 The Android Open Source Project'
How do I fix this? I tried running my script with it too but still same error.
Thanks in advance!

The git-shell is a login shell for SSH accounts to provide restricted Git access.
It permits execution only of server-side Git commands implementing the pull/push functionality, plus custom commands present in a subdirectory named git-shell-commands in the user’s home directory.
Therefore, if you don't have monkeyrunner (notice, not .bat or .sh here) setup in the git-shell-commands you won't be able to run it.

Related

mac os - How to create and activate conda (a virtual environment) from a bash script?

How to create and activate conda (a virtual environment) from a bash script?
I've read a lot of stack overflow posts already None of them really make any sense to me, given that I'm a beginner with bash. Also, most of them pertain to virtualenv, and not conda, which adds to the confusion.
I don't really understand how source or exec works, or if I even need to use it for this purpose.
All I'm trying to do is create a conda virtual environment from inside a bash script, and then activate it. Then run more commands via the bash script on the newly activated "environment".
Instead, what is happening when I run the script below, is that the environment is created, but it's not activated. It's also not helpful that the terminal asks for a prompt to proceed with the creation of the virtual environment (human input required not good).
Here's the script:
#!/bin/bash
dirname=$1
conda create -n $1 python=2.7
source activate $1
Terminal shows:
Jills-MBP:Desktop jillr$ bash site_builder.sh blah
Fetching package metadata: ....
Solving package specifications: ..........
Package plan for installation in environment /Users/jillr/anaconda/envs/blah:
The following NEW packages will be INSTALLED:
openssl: 1.0.2l-0
pip: 9.0.1-py27_1
python: 2.7.13-0
readline: 6.2-2
setuptools: 27.2.0-py27_0
sqlite: 3.13.0-0
tk: 8.5.18-0
wheel: 0.29.0-py27_0
zlib: 1.2.8-3
Proceed ([y]/n)?
The solution was as stupid as calling the entire script with "source" instead of "bash". UHHHHHHHHGGGG!
Instead of
bash site_builder.sh blah
Use
source site_builder.sh blah
If someone actually explains why this solves it, that would be fantastical, because I still don't understand what "source" is doing.
https://superuser.com/questions/46139/what-does-source-do says, "source is a bash shell built-in command that executes the content of the file passed as argument, in the current shell."
As opposed to what other shell?
"source script reads and executes commands from filename in the current shell environment"
What other shell would they be executed in?
What shell is "bash site_builder.sh blah" opposed to "source site_builder.sh blah" ??

Valgrind cannot execute memcheck tool on Android OS?

I've compiled Valgrind for ARM using this with minor alterations.
After installing on a phone with the method specified, I get the following error:
# /data/local/Inst/bin/valgrind
valgrind: failed to start tool 'memcheck' for platform 'arm-linux': Permission denied
On closer investigation, it is possible to find what it's trying to do:
# /data/local/Inst/bin/valgrind -d -v
--25068:1:debuglog DebugLog system started by Stage 1, level 1 logging requested
--25068:1:launcher no tool requested, defaulting to 'memcheck'
--25068:1:launcher no client specified, defaulting platform to 'arm-linux'
--25068:1:launcher launching /data/local/Inst/lib/valgrind/memcheck-arm-linux
valgrind: failed to start tool 'memcheck' for platform 'arm-linux': Permission denied
However, the executable is there and has the right permissions:
# ls -l /data/local/Inst/lib/valgrind/memcheck-arm-linux
-rwxrwxrwx root root 9261240 2013-10-28 17:00 memcheck-arm-linux
Furthermore, trying to execute it yields no problem, which eliminates dynamic linking problems as well:
/data/local/Inst/lib/valgrind/memcheck-arm-linux
valgrind: You cannot run '/data/local/Inst/lib/valgrind/memcheck-arm-linux' directly.
valgrind: You should use $prefix/bin/valgrind.
At this point, I'm mostly out of ideas, any help would be greatly appreciated.
I'm aware of this similar post, but I'm sure (based on the output with "-d") the prefix is right.
Potential clue: this worked a few "ROM"-s before, but unfortunately, this current one is the exact same on which it worked previously, with the exact same Valgrind build.
The minor alterations: since the build was done on a 64 bit system, _64 was appended to toolchain paths where appropriate. I can post the full script, but it should be irrelevant. Famous last words, potentially.
I recently ran into the exact same problem.
On my device /data/local/Inst and all of its content is owned by a user named "shell".
Strange enough, when I try to execute valgrind with the root user, I get the above-mentioned error, but as soon as I log in with the unprivileged user, I can run valgrind without any issues.
From the information you posted, I take, that you installed valgrind as the root user, and I assume you also executed it as root.
So here are the steps that got it working for me:
/data/local/Inst is owned by an unprivileged user
Install valgrind with the same unprivileged user
Again, execute valgrind with the same user
Hope this helps.
Normally, this indicates some files (either lib or config files) lack the permission to you. Most likelihood is when you install the Valgrind with root, the umask may exclude the rx for others.
It is easy to solve this by adding the rx permission for others:
find /usr/local -name "*valgrind*" -exec chmod o+rxt {} \;
If you use Valgrind on Android, at least there are three way to solve the problem. (You must root your Android phone first.)
On your PC
cmd
adb shell
$su
#cp /data/local/Inst/bin/valgrind /system/bin/
Note: Remember to chmod. For example chmod 777 valgrind.
On your Android phone
Install an app "Root Explorer". Copy valgrind to /system/bin/ with the app.
Write a shell script
This is a example: Can't run a Java Android program with Valgrind
Chinese Comments:
我本人曾不止一次英语考试不及格。写英文回贴真的很不舒服。不过自我学Android开始,就从http://stackoverflow.com 这里得到过很多帮助。 知恩回报是中华民族的传统美德,所以
就硬首头皮写了这个E文回贴。

Executing python script in android terminal emulator

I installed python 2.7 in my Android device and I tried executing a python script by typing the command in terminal emulator. The problem is that although I use the full path for python the following error appears:
link_image[1997]: failed to link ./python CANNOT LINK EXECUTABLE.
I tried to add environment variables in ./~bashrc but I didn't make it. Any idea ?
OK it is solved. I followed these steps (http://code.google.com/p/python-for-android/wiki/RunPythonFromShell) but first I had to put the file standalone_python.sh in /data/ because in sdcard I had no permission to execute. And finally using 'su' I made it to run my script as root.

SL4A don't work in terminal ide of my android

I have HTC One X, with Android 4. I have install sl4a, python, scapy and terminal IDE on my smartphone. All is alright, python in terminal IDE work well with scapy as root.
The problem happens when i use SL4A.
droid=android.Android(('127.0.0.1', '58322'))
droid.makeToast('Hello, Android!')
When i run the script there is no error, but at interpretation of makeToast() the program stops and nothing happens.
Anyone can help me to run a python script as root with SL4A in Terminal ?
I can tell you how to run it as root, but first let me mention that I do not believe that this is your issue. To make sure, try running this script:
# author: Matthew Downey
# purpose: Hello World.py script for android with SL4A
import android #this makes sure you can run android functions
droid = android.Android()
droid.makeToast('Hello, Android!') #uses the android module to display a user message
This should run fine, and does not require root. However if you are running a python script on your android that does require root (say you are using subprocess.call(command) to execute a command that requires root), try this (from the terminal on your android):
app_148#cdma_spyder:/ $ cd filepath_to_mypythonprogram/myProgram.py
app_148#cdma_spyder:/ $ su
app_148#cdma_spyder:/ # python myProgram.py
This should effectively run the python script as root, assuming your phone is rooted!
This might be of help: https://groups.google.com/forum/?fromgroups=#!searchin/python-for-android/socket.gaierror/python-for-android/s1rX9fTYPQQ/6_pHEm13gQwJ
Also your port shouldn't be in single quotes.

How does the shell script envsetup.sh execute launch?

launch 1
Segmentation fault
** Don't have a product spec for: 'full'
** Do you have the right repo manifest?
I have tried to download different sources n repo synced. I reinstalled the Linux and then carefully did the environment, all went well till I downloaded the source and then launch.
Ok left me with no other option than to look into the shell script of envsetup.sh which is throwing this error. I would like to debug from here so I run smthing like
bash --debugger build/envsetup.sh
But I don't know how to execute launch from here. As this script runs it gives the option for launch, will try setting the breakpoint at the source of the error.
We call the shell script envsetup.sh . When this script is sourced with the command
source build/envsetup.sh
I can execute all functions in this script as commands.For anyone who might wonder . Ty

Categories

Resources