Repo import readline error - android

I have tried to work with Android as described in http://source.android.com/source/downloading.html, but when I used repo, I have faced with this error:
import readline
ImportError: No module named readline
I am using Ubuntu 11.04 and Python 2.7.
I will be appreciated if anybody can help me.

Try installing libreadline5-dev

The readline is not avaliable becase the python installed with out readline module. You need to recompile your Python with readline included. You can do it like this, good luck!
$ source Install_Python2.7.5.sh
Shell script "Install_Python2.7.5.sh" is like this:
#!/bin/bash
sudo apt-get install libreadline-dev
sudo aptitude install build-essential libreadline5-dev
sudo apt-get install libbz2-dev
if [ ! -d ~/software/Python/Python-2.7.5 ]; then
mkdir ~/software
mkdir ~/software/Python
mkdir ~/software/Python/Python-2.7.5
fi
if [ ! -d ~/bin ]; then
mkdir ~/bin
fi
user_root=~
echo $user_root
echo "unpackage Python-2.7.5.tar.bz2..."
tar -jxvf Python-2.7.5.tar.bz2
echo "prepear to install Python-2.7.5"
cd Python-2.7.5
sed -i "s/#readline/readline/g" Modules/Setup.dist
echo "Start to install Python-2.7.5"
./configure --prefix=$user_root/software/Python/Python-2.7.5/ && make && make install
echo "Make symbol link"
ln -s -f $user_root/software/Python/Python-2.7.5/bin/* $user_root/bin
echo "Set environment variable"
PATH=$user_root/bin:$PATH

Related

Understanding connection issues when using libimobiledevice for Android to iOS connection

I'm trying to build a prototype Android app for connecting my Android device to an iOS device wirelessly. While researching for options, I came across libimobiledevice library which seems like the right fit. I'm currently stuck in what seems like iOS device is receiving the request but rejecting it and that's what I wanted to understand from this forum.
What I have done so far:
I have packaged libimobiledevice library as an .so file in my Android application and I able to make JNI calls from my Android app to call in methods of the library.
I'm also packaging in the libusbmuxd library and libplist as mentioned in the dependencies.
For protoyping, I'm creating a wifi hotspot from my Android device and connecting the iOS device. I also know the IP addresses of the two devices. I also know that the lockdownd deamon on iOS runs on port 62078. Given the IP address and port, when I make the call to the socket I do see that the idevice_new_with_options -> usbmuxd_get_device -> connect_usbmuxd_socket -> socket_connect is able to reach out to iOS device on the socket. Confirmed by looking at iOS logs
lockdownd[70] <Notice>: _receive_message: <private>
symptomsd(SymptomEvaluator)[120] <Notice>: Data Usage for lockdownd - WiFi in/out: 181637370/198768065, WiFi delta_in/delta_out: 458/0, Cell in/out: 0/0, Cell delta_in/delta_out: 0/0, RNF: 0, subscriber tag: 0
But immediately after this I see that the connection is dropped probably because lockdownd is rejecting it. I see the this getting triggered with error 104 which means "Connection reset by peer"
Questions:
As I understand it, the libimobiledevice is trying to make a TCP/IP connection to iPhone. And once the connection succeeds, I'll be able to use the rest of the capabilities of the library like invoking the mentioned services.
Is my setup correct or am I missing something? The code compiles and doesn't crash so it feels like I have all the needed dependencies.
How can I debug this further on iOS side to understant why lockdownd is reseting the connection?
Thanks!
libimobiledevice depends on usbmux, and for Linux this is not currently working wirelessly. You can overcome this by using the usbmuxd2 re-implementation.
This is my script for getting that full linux implementation up and running on a raspberry Pi. I also have a more user friendly walk through of the same thing right here: nMirrior
#!/bin/bash
echo "installing dependencies"
read -p "Do you want to update/install build tools (you need to if this is a new image) (y/n): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
sudo apt-get -q update
sudo apt-get -q install \
build-essential \
checkinstall \
git \
autoconf \
automake \
libtool-bin
fi
echo "installing libatomic"
sudo apt-get -q install libatomic-ops-dev libatomic1
echo "installing libimobiledevice dependencies"
sudo apt-get -q install \
libplist-dev \
libusbmuxd-dev \
libimobiledevice-dev \
libusb-1.0-0-dev \
libplist++-dev \
libssl-dev \
usbmuxd \
udev \
libavahi-client-dev \
avahi-utils
echo "Starting nMirror setup"
# Configure source directories
nMirrorDir=~/nMirror
echo "The applications needed for nMirror will be installed in $nMirror"
libplistDir=$nMirrorDir/libplist
libusbmuxdDir=$nMirrorDir/libusbmuxd
libimobiledeviceDir=$nMirrorDir/libimobiledevice
libgeneralDir=$nMirrorDir/libgeneral
usbmuxd2Dir=$nMirrorDir/usbmuxd2
#Standard libimobiledevice repos
libplistGit=https://github.com/libimobiledevice/libplist.git
libusbmuxdGit=https://github.com/libimobiledevice/libusbmuxd.git
libimobiledeviceGit=https://github.com/libimobiledevice/libimobiledevice.git
#tihmstar repo for usbmuxd2 to support network connection to iDevice
usbmuxd2Git=https://github.com/tihmstar/usbmuxd2.git
libgeneralGit=https://github.com/tihmstar/libgeneral.git
# Create the project directory if it does not exist
mkdir -p $nMirrorDir
cd $nMirrorDir
# Fetch the repos
fetchnext=false
if test -d $libplistDir; then
read -p "libplist directory exists. Remove and re-fetch new? (y/n): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
rm -rf $libplistDir
fetchnext=true
fi
else
fetchnext=true
fi
if [ "$fetchnext" == true ]; then
echo "Cloning from git. 1 - libplist"
cd $nMirrorDir
git clone --quiet $libplistGit
cd $libplistDir
# git checkout 2.2.0 # Cannot go back to the last tag (2.2.0) because usbmuxd2 want 2.2.1 - just get the head for now
fi
if test -d $libusbmuxdDir; then
read -p "libusbmuxd directory exists. Remove and re-fetch new? (y/n): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
rm -rf $libusbmuxdDir
fetchnext=true
fi
else
fetchnext=true
fi
if [ "$fetchnext" == true ]; then
echo "Cloning from git. 2 - libusbmuxd (Normal)"
cd $nMirrorDir
git clone --quiet $libusbmuxdGit
cd $libusbmuxdDir
git checkout 2.0.2
fi
if test -d $libimobiledeviceDir; then
read -p "libimobiledevice directory exists. Remove and re-fetch new? (y/n): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
rm -rf $libimobiledeviceDir
fetchnext=true
fi
else
fetchnext=true
fi
if [ "$fetchnext" == true ]; then
echo "Cloning from git. 3 - libimobiledevice"
cd $nMirrorDir
git clone --quiet $libimobiledeviceGit
cd $libimobiledeviceDir
git checkout 1.3.0
fi
#tihmstar repo for usbmuxd2 to support network connection to iDevice
if test -d $libgeneralDir; then
read -p "libgeneral directory exists. Remove and re-fetch new? (y/n): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
rm -rf $libgeneralDir
fetchnext=true
fi
else
fetchnext=true
fi
if [ "$fetchnext" == true ]; then
echo "Cloning from git. 4 - libgeneral (tihmstar Experimental repo tag 55)"
cd $nMirrorDir
git clone --quiet $libgeneralGit
cd $libgeneralDir
git checkout 55
fi
if test -d $usbmuxd2Dir; then
read -p "usbmuxd2 directory exists. Remove and re-fetch new? (y/n): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
rm -rf $usbmuxd2Dir
fetchnext=true
fi
else
fetchnext=true
fi
if [ "$fetchnext" == true ]; then
echo "Cloning from git. 5 - usbmuxd2 (tihmstar Eperimental repo)"
cd $nMirrorDir
git clone --quiet $usbmuxd2Git
cd $usbmuxd2Dir
git submodule init
git submodule update
fi
#build stage
cd $libplistDir
./autogen.sh
make
sudo make install
cd $libusbmuxdDir
./autogen.sh
make
sudo make install
cd $libimobiledeviceDir
./autogen.sh
make
sudo make install
sudo ldconfig
#configure Avahi for zeroconf as per https://www.raspberrypi.org/forums/viewtopic.php?t=267113
#Note: Zeroconf may not be desirable - use with caution
cd $nMirrorDir
#create avahi patch
tee avahi.patch <<EOF
--- /etc/avahi/avahi-daemon.conf 2021-08-16 23:59:16.917672251 +0100
+++ /etc/avahi/avahi-daemon_usbmuxd.conf 2021-08-17 09:45:02.096575347 +0100
## -20,7 +20,7 ##
[server]
#host-name=foo
-#domain-name=local
+domain-name=local
#browse-domains=0pointer.de, zeroconf.org
use-ipv4=yes
use-ipv6=yes
## -46,8 +46,8 ##
#disable-user-service-publishing=no
#add-service-cookie=no
#publish-addresses=yes
-publish-hinfo=no
-publish-workstation=no
+publish-hinfo=yes
+publish-workstation=yes
#publish-domain=yes
#publish-dns-servers=192.168.50.1, 192.168.50.2
#publish-resolv-conf-dns-servers=yes
EOF
cd /etc
sudo patch -p2 < $nMirrorDir/avahi.patch
#enable the avahi-daemon
systemctl list-unit-files avahi-daemon.service
#activate/enable the avahi-daemon.service
sudo systemctl enable avahi-daemon.service
sudo systemctl start avahi-daemon.service
sudo systemctl restart avahi-daemon.service
#enable ssh service
sudo systemctl enable ssh.service
sudo systemctl start ssh.service
#avahi-browse -a
# if using gcc: the patch below works to include -latomic
# if using clang: make CXX=clang++
cd $libgeneralDir
./autogen.sh
make CFLAGS="-g -O2 -std=c11 -latomic" LDFLAGS=-latomic
sudo make install
sudo ldconfig
cd $usbmuxd2Dir
#create log patch
#cassure only needed for versions after 55 - probably remove this as checkout is fixed to 55
tee log.patch <<EOF
--- a/configure.ac
+++ b/configure.ac
## -29,7 +29,7 ## case $host_os in
have_mdns="yes"
;;
*)
- LDFLAGS+=" -lstdc++fs"
+ LDFLAGS+="-latomic -lstdc++fs"
;;
esac
EOF
git apply log.patch
./autogen.sh
make
sudo make install
sudo ldconfig
# get the BT PAN up and running
sudo apt-get install bluez-tools
sudo tee /etc/systemd/network/pan0.netdev <<EOF
[NetDev]
Name=pan0
Kind=bridge
EOF
sudo tee /etc/systemd/network/pan0.network <<EOF
[Match]
Name=pan0
[Network]
Address=172.20.1.1/24
DHCPServer=yes
EOF
sudo tee /etc/systemd/system/bt-agent.service <<EOF
[Unit]
Description=Bluetooth Auth Agent
[Service]
#ExecStart=/usr/bin/bt-agent -c NoInputNoOutput
ExecStart=/bin/sh -c '/usr/bin/yes | /usr/bin/bt-agent --capability=NoInputNoOutput' #autoaccept
Type=simple
[Install]
WantedBy=multi-user.target
EOF
sudo tee /etc/systemd/system/bt-network.service <<EOF
[Unit]
Description=Bluetooth NEP PAN
After=pan0.network
[Service]
ExecStart=/usr/bin/bt-network -s nap pan0
Type=simple
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable systemd-networkd
sudo systemctl enable bt-agent
sudo systemctl enable bt-network
sudo systemctl start systemd-networkd
sudo systemctl start bt-agent
sudo systemctl start bt-network
sudo bt-adapter --set Discoverable 1
# list devices. Need to ask the user to connect via USB the first time using idevicesyslog. Then make the BT PAN connection and connect via idevicesyslog -n
/usr/local/bin/idevice_id

Android sdkmanager --licenses freezes without any output

I have a Dockerfile like this:
FROM debian:9
RUN apt-get update -y && \
apt-get install -y --no-install-recommends wget unzip openjdk-8-jdk
RUN wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip -O sdk-tools-linux.zip
RUN unzip sdk-tools-linux.zip
And when I ran
docker run -it my-image /tools/bin/sdkmanager --licenses it just hung there for a million years.
Then later I changed a few things around, and started getting this bizarre error message:
Exception in thread "main" java.nio.file.InvalidPathException: Malformed input or input contains unmappable characters: /proc/self/task/1/cwd/etc/ssl/certs/T??RKTRUST_Elektronik_Sertifika_Hizmet_Sa??lay??c??s??_H5.pem
at sun.nio.fs.UnixPath.encode(UnixPath.java:147)
at sun.nio.fs.UnixPath.<init>(UnixPath.java:71)
at sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:281)
at com.android.repository.io.impl.FileSystemFileOp.toPath(FileSystemFileOp.java:284)
at com.android.repository.io.impl.FileSystemFileOp.isDirectory(FileSystemFileOp.java:169)
at com.android.repository.impl.manager.LocalRepoLoaderImpl.collectPackages(LocalRepoLoaderImpl.java:225)
at com.android.repository.impl.manager.LocalRepoLoaderImpl.collectPackages(LocalRepoLoaderImpl.java:226)
at com.android.repository.impl.manager.LocalRepoLoaderImpl.collectPackages(LocalRepoLoaderImpl.java:226)
at com.android.repository.impl.manager.LocalRepoLoaderImpl.collectPackages(LocalRepoLoaderImpl.java:226)
at com.android.repository.impl.manager.LocalRepoLoaderImpl.collectPackages(LocalRepoLoaderImpl.java:226)
at com.android.repository.impl.manager.LocalRepoLoaderImpl.collectPackages(LocalRepoLoaderImpl.java:226)
at com.android.repository.impl.manager.LocalRepoLoaderImpl.collectPackages(LocalRepoLoaderImpl.java:226)
at com.android.repository.impl.manager.LocalRepoLoaderImpl.collectPackages(LocalRepoLoaderImpl.java:226)
at com.android.repository.impl.manager.LocalRepoLoaderImpl.collectPackages(LocalRepoLoaderImpl.java:226)
at com.android.repository.impl.manager.LocalRepoLoaderImpl.collectPackages(LocalRepoLoaderImpl.java:201)
at com.android.repository.impl.manager.LocalRepoLoaderImpl.getPackages(LocalRepoLoaderImpl.java:123)
at com.android.repository.impl.manager.RepoManagerImpl$LoadTask.run(RepoManagerImpl.java:518)
at com.android.repository.api.RepoManager$DummyProgressRunner.runSyncWithProgress(RepoManager.java:397)
at com.android.repository.impl.manager.RepoManagerImpl.load(RepoManagerImpl.java:365)
at com.android.repository.api.RepoManager.loadSynchronously(RepoManager.java:290)
at com.android.sdklib.repository.AndroidSdkHandler$RepoConfig.createRepoManager(AndroidSdkHandler.java:725)
at com.android.sdklib.repository.AndroidSdkHandler.getSdkManager(AndroidSdkHandler.java:296)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.setSdkHandler(SdkManagerCliSettings.java:101)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.<init>(SdkManagerCli.java:95)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:74)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
I feel so helpless.
You fool! Why are you extracting the android sdk zip into the root directory on your docker image? Move it outside the root, and everything will work!
FROM debian:9
RUN apt-get update -y && \
apt-get install -y --no-install-recommends wget unzip openjdk-8-jdk
RUN wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip -O sdk-tools-linux.zip
RUN mkdir -p /sdk
RUN mv sdk-tools-linux.zip /sdk
RUN cd /sdk && unzip sdk-tools-linux.zip
docker build . -t my-image && docker run -it my-image sdk/tools/bin/sdkmanager --licenses

How to install Heroku on Termux

I want to install Heroku on Termux on my Android Tecno droipad but I get this message after each trial:
$ apt install heroku
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package heroku
That's what I get when I run the command: $apt install heroku.
What should I do to have heroku installed?
From this Github repo :
termux-chroot
cd /
wget
https://cli-assets.heroku.com/branches/stable/heroku-linux-arm.tar.gz
mkdir -p /usr/local/lib /usr/local/bin
tar -xvzf heroku-OS-ARCH.tar.gz -C /usr/local/lib
ln -s /usr/local/lib/heroku/bin/heroku /usr/local/bin/heroku
/usr/local/lib/heroku/install
cd /home/.local/share/heroku/cli/lib
mv node node_broken
ln -s /usr/bin/node ./node

Permission Denied: Initializing repo for building Android source

Linux and programming noob here...
I'm following the instructions # http://source.android.com/source/downloading.html
I run into trouble when I run the following line:
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
I get:
bash: /home/dev/bin/repo: Permission denied
And yes I've tried to sudo it.
Thank you! :)
==================================================================================
EDIT:
I downloaded the script manually in a browser, popped-it into the home/dev/bin/ directory, and I am still unable to progress. Here is what my terminal window is giving me:
dev#Android-Dev:~$ sudo chmod a+x ~/bin/repo
[sudo] password for dev:
dev#Android-Dev:~$ cd /home/dev/bin/
dev#Android-Dev:~/bin$ sudo mkdir wip
dev#Android-Dev:~/bin$ cd wip
dev#Android-Dev:~/bin/wip$ repo init -u **<This is where the URL goes>**
fatal: cannot make .repo directory: Permission denied
dev#Android-Dev:~/bin/wip$ sudo repo init -u **<This is where the URL goes>**
sudo: repo: command not found
dev#Android-Dev:~/bin/wip$ cd bin
bash: cd: bin: No such file or directory
dev#Android-Dev:~/bin/wip$ cd ..
dev#Android-Dev:~/bin$ sudo repo init -u **<This is where the URL goes>**
sudo: repo: command not found
I ran into the same problem. changing the ownership helped me. When I try to curl https..://myrepo...u...r...l../repo > ./repo into my /opt/android dir it gives me this error.
I do sudo chown -R shraddha /opt/android that works
In CYGWIN you can do below.
edit .bash_profile and uncomment these fields. (any text editor will do)
# Set PATH so it includes user's private bin if it exists
# if [ -d "${HOME}/bin" ] ; then
# PATH="${HOME}/bin:${PATH}"
# fi
Restart CYGWIN.
Under BASH, enter:
$ export PATH=$PATH:~/bin
Or add as follows to your .bashrc file:
$ echo 'export PATH=$PATH:~/bin' >> ~/.bashrc
If you are using CSH / TCSH, enter:
$ echo 'set PATH = ($PATH ~/bin /scripts/admin)' >> ~/.cshrc
To display path settings, enter:
$ echo $PATH
Maybe you're behind a proxy? Try to download repo tool manually (just put this link into your browser). (I guess that maybe this resource can be prohibited for you). And then put it into this folder and assign permissions to it. I do not see any wrong steps in what you've described so far.
you can try this:
wget http://git-repo.googlecode.com/files/repo-1.14
After that,
you can see the repo-1.14, and you can mv it to anywhere or change the name,such as :
sudo mv repo-1.14 ~/bin/repo
The repo file is not executable. Run chmod a+x ~/bin/repo to turn it into an executable file and this should fix your problem.

"ImportError: No module named readline" running "repo init"

I downloaded the source of Android, but when I used repo init according to the website, I got the following error:
Traceback (most recent call last):
File "/root/bin/repo", line 91, in <module>
import readline
ImportError: No module named readline
I am using Ubuntu 10.04 and Python 2.7.2
AFAIK, the default Python environment in Ubuntu 10.04 is Python 2.6.5, so you must be using a self-compiled python.
You should be missing some readline header files when building your python 2.7.2, so you have two choices now:
Re-compile your python, with libreadline?-dev installed.
Install the standalone version of readline, using pip install readline or easy_install readline
I have the same issue, and I fixed it in this way, hope it will be helpful to you.
$ source Install_Python2.7.5.sh
Shell script "Install_Python2.7.5.sh" is like this:
#!/bin/bash
sudo apt-get install libreadline-dev
sudo aptitude install build-essential libreadline5-dev
sudo apt-get install libbz2-dev
if [ ! -d ~/software/Python/Python-2.7.5 ]; then
mkdir ~/software
mkdir ~/software/Python
mkdir ~/software/Python/Python-2.7.5
fi
if [ ! -d ~/bin ]; then
mkdir ~/bin
fi
user_root=~
echo $user_root
echo "unpackage Python-2.7.5.tar.bz2..."
tar -jxvf Python-2.7.5.tar.bz2
echo "prepear to install Python-2.7.5"
cd Python-2.7.5
sed -i "s/#readline/readline/g" Modules/Setup.dist
echo "Start to install Python-2.7.5"
./configure --prefix=$user_root/software/Python/Python-2.7.5/ && make && make install
echo "Make symbol link"
ln -s -f $user_root/software/Python/Python-2.7.5/bin/* $user_root/bin
echo "Set environment variable"
PATH=$user_root/bin:$PATH

Categories

Resources