2012-06-29 22:54:38 +08:00
|
|
|
aria2 for Android devices
|
|
|
|
=========================
|
|
|
|
|
|
|
|
aria2 is a lightweight multi-protocol & multi-source download utility
|
|
|
|
operated in command-line. It supports HTTP/HTTPS, FTP, BitTorrent and
|
|
|
|
Metalink.
|
|
|
|
|
|
|
|
Install
|
|
|
|
-------
|
|
|
|
|
|
|
|
aria2 is not an ordinary Android Java application. It is a C++ native
|
|
|
|
application and operates in command-line. You don't have to 'root'
|
|
|
|
your device to use aria2. Because aria2 is a command-line program,
|
|
|
|
you need a terminal emulator. First install Android Terminal Emulator
|
|
|
|
from Android Market (or build it from source and install. See
|
|
|
|
https://github.com/jackpal/Android-Terminal-Emulator/).
|
|
|
|
|
|
|
|
1. Copy aria2c executable to ``/mnt/sdcard`` on your device.
|
|
|
|
2. Run Android Terminal Emulator.
|
|
|
|
3. ``mkdir /data/data/jackpal.androidterm/aria2``
|
|
|
|
4. ``cat /mnt/sdcard/aria2c > /data/data/jackpal.androidterm/aria2/aria2c``
|
|
|
|
5. ``chmod 744 /data/data/jackpal.androidterm/aria2/aria2c``
|
|
|
|
6. Add the following commands to the initial command of Android
|
|
|
|
Terminal Emulator::
|
|
|
|
|
|
|
|
export HOME=/data/data/jackpal.androidterm/aria2; cd $HOME
|
|
|
|
|
|
|
|
7. Exit Android Terminal Emulator.
|
|
|
|
8. Run Android Terminal Emulator again.
|
|
|
|
9. See whether aria2c actually works by invoking ``./aria2c -v``
|
|
|
|
|
|
|
|
How to use
|
|
|
|
----------
|
|
|
|
|
|
|
|
See `the online manual
|
|
|
|
<http://aria2.sourceforge.net/manual/en/html/>`_.
|
|
|
|
|
|
|
|
Notes
|
|
|
|
-----
|
|
|
|
|
2015-09-27 22:50:14 +08:00
|
|
|
aria2c executable was generated using android-ndk-r10d.
|
2012-06-29 22:54:38 +08:00
|
|
|
|
|
|
|
The following libraries were statically linked.
|
|
|
|
|
2015-12-06 21:27:27 +08:00
|
|
|
* openssl 1.0.2e
|
2015-05-16 22:00:26 +08:00
|
|
|
* expat 2.1.0
|
|
|
|
* c-ares 1.10.0
|
2015-09-27 22:50:14 +08:00
|
|
|
* libssh2 1.6.0
|
2012-06-29 22:54:38 +08:00
|
|
|
|
|
|
|
Since Android does not have ``/etc/resolv.conf``, c-ares (asynchronous
|
|
|
|
DNS resolver) is disabled by default. But name resolution is sometimes
|
|
|
|
a little bit slow, so I recommend to enable c-ares. You can enable it
|
|
|
|
using ``--async-dns`` and specify DNS servers using
|
|
|
|
``--async-dns-server`` option, like this::
|
|
|
|
|
|
|
|
--async-dns --async-dns-server=`getprop net.dns1`,`getprop net.dns2`
|
|
|
|
|
2015-08-30 12:59:13 +08:00
|
|
|
Additionally, the CA certificates shipped with Android don't locate in
|
|
|
|
the same place as those of normal Unix-like systems do, so this
|
|
|
|
workaround might be useful to securely download files via HTTPS::
|
|
|
|
|
|
|
|
cat /etc/security/cacerts/* | aria2c --ca-certificate=/proc/self/fd/0 $@
|
|
|
|
|
2012-06-29 22:54:38 +08:00
|
|
|
Because it is tedious to type these long parameters every time you use
|
|
|
|
aria2c, the following wrapper shell script would be handy::
|
|
|
|
|
|
|
|
#!/system/bin/sh
|
2015-08-30 12:59:13 +08:00
|
|
|
cat /etc/security/cacerts/* | \
|
2012-06-29 22:54:38 +08:00
|
|
|
/data/data/jackpal.androidterm/aria2c \
|
2015-08-30 12:59:13 +08:00
|
|
|
--ca-certificate=/proc/self/fd/0 \
|
2012-06-29 22:54:38 +08:00
|
|
|
--async-dns \
|
|
|
|
--async-dns-server=`getprop net.dns1`,`getprop net.dns2` \
|
|
|
|
"$@"
|
|
|
|
|
|
|
|
Please note that you need to add executable file mode bit to this
|
|
|
|
wrapper script too. (e.g., ``chmod 744 /PATH/TO/SCRIPT``)
|
|
|
|
|
|
|
|
Known Issues
|
|
|
|
------------
|
|
|
|
|
|
|
|
* Since Android does not have ``/dev/stdout``, ``-l-`` does not work.
|
2015-08-30 12:59:13 +08:00
|
|
|
``/proc/self/fd/0`` is a workaround for Android.
|
2012-06-29 22:54:38 +08:00
|
|
|
|
|
|
|
* Android Terminal Emulator sometimes stops updating console. It looks
|
|
|
|
like aria2c hangs, but aria2c continues to run.
|