I have some trouble to run a docker android emulation from this project: https://github.com/thyrlian/AndroidSDK
Since I am a Linux (using Ubuntu 18) noob maybe I am just too stupid...
I'm failing with mounting the image to my container...in the tutorial its done with this command:
docker run -it --rm -v $(pwd)/sdk:/sdk thyrlian/android-sdk bash -c 'cp -a $ANDROID_HOME/. /sdk'
So i downloaded android-sdk-tools and extracted it into my root dir named "sdk". so my command looked like this:
docker run -it --rm -v sdk bash -c 'cp -a $ANDROID_HOME/. /sdk'
But than I got tons of errors (those are just a few since they are all similiar):
cp: can't open '/./sys/bus/isa/uevent': Permission denied
cp: can't open '/./sys/bus/isa/drivers_probe': Permission denied
cp: can't open '/./sys/bus/xen/uevent': Permission denied
cp: can't open '/./sys/bus/xen/drivers_probe': Permission denied
cp: can't open '/./sys/bus/serio/uevent': Permission denied
Related
Why do I keep getting this error?
>> gcc a.out
>> ./a.out
bash: ./a.out: Permission denied
I even tried this
>> chmod +x a.out
But still I keep getting the error. I have installed clang and termux-setup-storage package. My files are in main memory (not on sd card).
Termux has only problem executing a.out file. If I make any error in C program it fails to compile the a.c file
You can't execute executable in internel storage because that's mount with noexec in android.
Move that binary somewhere in termux home directory or $PREFIX.
so if you need to run those file than you need to run
$ ls //to see your file is here or not .if not than change directory
$ mv a.out ~
$cd ~
$chmod +x a.out
$./a.out
If you just installed termux api?
$ pkg install root-repo
Revoke termux app permission in settings.
$ termux-setup-storage
And taraa!!
With python 3.6.4:
In a fresh Termux installation I do accordnung to https://wiki.termux.com/wiki/Arch
pkg install wget
wget https://raw.githubusercontent.com/sdrausty/TermuxArch/master/setupTermuxArch.sh
bash setupTermuxArch.sh
After that in ArchLinux:
$ pacman -S python python-pip
(success)
$ pip install simplejson (or any other package)
And always get:
running install_egg_info
running egg_info
writing simplejson.egg-info/PKG-INFO
writing dependency_links to simplejson.egg-info/dependency_links.txt
writing top-level names to simplejson.egg-info/top_level.txt
reading manifest file 'simplejson.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'simplejson.egg-info/SOURCES.txt'
Copying simplejson.egg-info to /root/.local/lib/python3.6/site-packages/simplejson-3.13.2-py3.6.egg-info
error: [Errno 13] Permission denied: '/root/.local/lib/python3.6/site-packages/simplejson-3.13.2-py3.6.egg-info/PKG-INFO'
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-r_x__623/simplejson/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-4dfnzavt-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-r_x__623/simplejson/
Also --user or pyvenv don't help at all. Any suggestions, what am I doing wrong?
Please note:
Android device is not rooted
The ArchLinux user is root (default)
Permissions look good. I can copy files manually to the destination directory just ok.
UPDATE: With python 2.7.14 everything works well.
I am trying to copy the shared preferences folder of my app to the /sdcard partition from my PC using the following ADB command:
adb shell su -c "cp
/data/data/com.anrapps.pixelbatterysaver/shared_prefs/
/sdcard/appdata/"
But this returns cp: Skipped dir '/data/data/com.anrapps.pixelbatterysaver/shared_prefs': No such file or directory. However when executing the ls command, it says that folder is present:
adb shell su -c "ls /data/data/com.anrapps.pixelbatterysaver"
cache
code_cache
files
shared_prefs
What is the problem? May be permission related?
If you're trying to copy a whole directory, you need to use cp -r to make it a recursive copy.
I was trying to run cocos2dx HelloCpp sample project on Android, building from Windows-7 64 bit with Cygwin 64 bit, however, everytime I try to build and run, it complains that permission was denied on "Marker Felt.fnt" file in assets/font folder.
I checked that there's no permission on that file and chmod to give it proper permission, but everytime I try to run again, that file seems to be regenerated and has no permission again...
Does anyone has the same problem? I have been googling and the nearest problem I've found is this:
Cocos2dx Android: Get data from file(assets/*) failed
However, it is quite different. I've tried disabling UAC on my Windows machine, but the problem doesn't go away
Any help is highly appreciated
Check the proj.android/build_native.sh, every time you run the build, the entire assets/* folder will be re-created, and thus, your chmod is nullified.
You can chmod after the copy process itself in the build_native.sh, place the chmod somewhere after cp the assets/*
in my case, put
chmod 777 -R "$APP_ANDROID_ROOT"/assets
after copying the assets folder in build_native.sh like this:
if [ -f "$file" ]; then
cp "$file" "$APP_ANDROID_ROOT"/assets
fi
chmod 777 -R "$APP_ANDROID_ROOT"/assets
done
My same BASH script is working in Fedora/CentOS.
But I am testing one Android eee pad transformer.
Where i have terminal access and i wrote a small test script. But its not working, how can i fix it? what am i doing wrong?
/data/data/berserker.android.apps.sshdroid/home $ cat test.sh
#!/bin/bash
var=`ifconfig -a`;
echo $var;
/data/data/berserker.android.apps.sshdroid/home $ chmod +x test.sh
/data/data/berserker.android.apps.sshdroid/home $ ./test.sh
sh: ./test.sh: not found
/data/data/berserker.android.apps.sshdroid/home $ uname -a
Linux localhost 2.6.36.3-00004-g069b8b5 #1 SMP PREEMPT Wed May 11 22:14:22 CST 2011 armv7l GNU/Linux
/data/data/berserker.android.apps.sshdroid/home $ bash ./test.sh
sh: bash: Permission denied
/data/data/berserker.android.apps.sshdroid/home $ ls -l /bin/bash
ls: /bin/bash: No such file or directory
/data/data/berserker.android.apps.sshdroid/home $ find / -name "bash"
find: /config: Permission denied
lots more.......
find: /proc/595/task/598/fd: Permission denied
......
find: /data: Permission denied
find: /root: Permission denied
Follow up:
This is my script now which works:
#!/bin/sh
echo "hello wassup, run me simply as './test.sh'";
or
#!/bin/bash
echo "hello wassup, run me using 'sh ./test.sh'";
in Android the shell is located in /system/bin/sh not /bin/sh like it is on most Unix-like systems. So even if you change #!/bin/bash to #!/bin/sh it will still not work. you'll have to use #!/system/bin/sh
Android is not a GNU/Linux distribution so you can't expect that all scripts that run on GNU/Linux to also work on Android.
May be it will work when calling interpreter with a script?
$ bash ./test.sh
I saw, that although it is specified #!/bin/bash error was posted by sh - may be it do wrong.
UPD
$ sh ./test.sh
Most Android devices don't have a bash interpreter installed. If you really need to run the script across Linux and Android, you could try using BusyBox but that will require rooting your device (and potentially voiding your warranty). Even then though, I don't know if the ifconfig utility is included in BusyBox.
I would strongly recommend using the Android SDK to write an app to do whatever your trying to accomplish.
As was stated, the Android OS (up to and including 4.0) does not include the BASH interpreter (just shell). While BusyBox is a great tool, I believe it's only a single executable that combines stripped-down-functionality-for-size versions of common UNIX utilities, but doesn't actually include the BASH interpreter.
For an Android compiled version of the BASH interpreter, refer to this Forum thread:
http://forum.xda-developers.com/showthread.php?t=537827
You can install Busybox, which provides you with many utilities such as awk, file, etc... and Terminal Emulator.
Create a shell file with #!/system/bin/sh as the first line (shebang)
Now place the completed script under /system/xbin or /system/bin and run it from the Terminal Emulator
The information is an excerpt from this article : HOW TO RUN SHELL SCRIPTS ON ANDROID DEVICES