Android and ArchLinux 64bit[-][--][++]

:rg:
Easy install is to add [[multilib]] to your /etc/pacman.conf file then through aur install android-sdk

ArchLinux Android Development[-][--][++]

  1. sudo pacman -S jdk eclipse
  2. sudo yaourt -S android-sdk Note, the android-sdk is in the AUR, which is why I use yaourt
  3. Add /opt/android-sdk/tools if not already added by installer in /etc/profile and logout and back in or restart
  4. Run eclipse
  5. Install the WST Server Adapters
    1. In eclipse, Help->Install New Software
    2. Select the 'Helios - http://download.eclipse.org/releases/helios' item from the 'Work With:' dropdown
    3. Expand the 'Web, XML, and Java EE Development' item
    4. At the bottom of that expanded section, check 'WST Server Adapters'
    5. Click Next, and continue with installation
  6. Install the ADT (Android Development Toolkit)
    1. I followed http://developer.android.com/sdk/eclipse-adt.html basically it said:
    2. In eclipse, Help->Install New Software
    3. Click the 'Add' button
    4. Name: 'ADT Plugin', url: https://dl-ssl.google.com/android/eclipse/
    5. Select the 'Developer Tools' checkbox
    6. Click Next, and continue with installation
  7. In Eclipse, goto Window->Preferences and expand 'Android' and set the android path to /opt/android-sdk
  8. In Eclipse, goto Windows->Android SDK and AVD Manager
    1. In the android SDK GUI Click 'Available Packages'
    2. Expand 'Android Repository', install:
      1. Android SDK Platform-tools
      2. SDK Platform Android 3.0, API 11, revision 1 (or whatever your target dev platform will be, I want to dev for 3.0 honeycomb)
      3. Samples for SDK API 11, revision 1
    3. Then click install selected
  9. Now you can add your Virtual Devices and begin development

Best to run Android SDK as same user you run Eclipse since your AVD are stored in your home directory

Motorola Xoom[-][--][++]

Once you get your eclipse and Android SDK development environment going, add a new Motorola Xoom Android Virtual Machine (AVD) to your SDK and start coding.

  1. Setup AVD to xoom specs http://mobile.tutsplus.com/tutorials/android/android-sdk_tablet_virtual-device-configuration/

On-click-root
http://androidcommunity.com/motorola-xoom-root-the-easy-way-with-1-click-root-and-overclock-guide-20110331/

Old chroot junk[-][--][++]

Chroot is not required when using [[multilib]]. But this is a nice tutorial on chroot, move to own topic sometime

Fixme
Quick setup instructions for the Android SDK on ArchLinux 64bit.

Unfortunately several parts of the Android SDK do not run properly on 64bit linux. One such part is the mksdcard script used in the Virtual Devices section of the Android GUI, so building Virtual Devices doesn't work, and who knows what else.

So to start developing for android in archlinux 64bit, you must first install the 32 bit libraries. In ubuntu this is a piece of cake, just apt-get install lib32 or something like that. In arch linux its a bit harder. I have taken most of this 32bit guide from https://wiki.archlinux.org/index.php/Install_bundled_32-bit_system_in_Arch64 and I have also contributed back to that wiki. This is a quick and dirty version of that wiki thats geared toward getting the Android SDK running.

Install 32bit chroot on 64bit ArchLinux[-][--][++]

Note, this entire section is done as root, and you must chroot into your new /opt/arch32 using root also, chroot does not allow chrooting by a non-root user

  1. # mkdir /opt/arch32
  2. # sed -e 's/\$arch/i686/g' /etc/pacman.d/mirrorlist > /opt/arch32/mirrorlist
  3. # sed -e 's@/etc/pacman.d/mirrorlist@/opt/arch32/mirrorlist@g' /etc/pacman.conf > /opt/arch32/pacman.conf
  4. # mkdir -p /opt/arch32/var/{cache/pacman/pkg,lib/pacman}
  5. Now edit your /opt/arch32/pacman.conf file and change to Architecture = i686
  6. # pacman --root /opt/arch32 --cachedir /opt/arch32/var/cache/pacman/pkg --config /opt/arch32/pacman.conf -Sy
  7. # pacman --root /opt/arch32 --cachedir /opt/arch32/var/cache/pacman/pkg --config /opt/arch32/pacman.conf -S base
  8. # rm /opt/arch32/{mirrorlist,pacman.conf}
  9. Make a new file /etc/rc.d/arch32 with
#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

dirs=(/dev /dev/pts /dev/shm /tmp /home)
case $1 in
    start)
        stat_busy "Starting Arch32 chroot"
        for d in "${dirs[@]}"; do
         mount -o bind $d /opt/arch32/$d
        done
        mount -t proc none /opt/arch32/proc
        mount -t sysfs none /opt/arch32/sys
        add_daemon arch32
        stat_done
        ;;
    stop)
        stat_busy "Stopping Arch32 chroot"
        for (( i = ${#dirs[@]} - 1; i >= 0; i-- )); do
         umount "/opt/arch32${dirs[i]}"
        done
        umount /opt/arch32/{proc,sys}
        rm_daemon arch32
        stat_done
        ;;
    restart)
        $0 stop
        sleep 1
        $0 start
        ;;
    *)
        echo "usage: $0 {start|stop|restart}"
esac
exit 0
  1. Add it to your deamons array in /etc/rc.conf Example: DAEMONS=(syslog-ng network netfs arch32 crond)
  2. # chmod +x /etc/rc.d/arch32
  3. Run all these commands (remember, your still root root)
cd /opt/arch32/etc

ln -f /etc/passwd* .
ln -f /etc/shadow* .
ln -f /etc/group* .
ln -f /etc/sudoers .  # note: you'll need to install sudo before creating this entry, or sudo will refuse to install

ln -f /etc/rc.conf .
ln -f /etc/resolv.conf .

ln -f /etc/localtime .
ln -f /etc/locale.gen .
ln -f /etc/profile.d/locale.sh profile.d

cp /etc/vimrc .
cp /etc/mtab .
  1. # /etc/rc.d/arch32 start
  2. # chroot /opt/arch32 Now your in your new 32bit chroot!

Every command from here on out is after the above chroot /opt/arch32, meaning you are now chrooted into your new 32bit system, not your regular 64bit system

Oh and be sure, when installing things with pacman inside your chroot, that all packages say .i686 as they go flying by, if you see x86_64 on any package, you missed something.

  1. Very first thing: Edit your /etc/pacman.conf again with the Architecture = i686
  2. And edit your /etc/pacman.d/mirrorlist file, because all urls will be commented out (because of fresh base install), just uncomment all the USA lines
  3. # pacman -Sy
  4. # /usr/sbin/locale-gen
  5. # pacman -S leafpad gtk-engines gtk-engine-murrine ttf-dejavu ttf-bitstream-vera. I install leafpad because I use it, also because it installs its GTK dependencies...
  6. Now I run lxappearance and set my GTK theme to the murrine, because it matches my 64bit xmonad gtk theme Wink
  7. Should be able to test everything by simply running leafpad, leafpad should popup like a regular program, but it will be the 32bit leafpad running through your chroot!

Installing Android SDK, JDK, Eclipse within 32bit Chroot[-][--][++]

Now that you have a 32bit chroot environment on your 64bit ArchLinux installation, you can install jdk, eclipse and the Android SDK as usual, But you must be inside your chroot. Don't install these packages on your regular 64bit environment, they (Android SDK) won't work.

To install these packages in 32bit, from your standard 64bit system, run as root: chroot /opt/arch32, then follow the ArchLinux Android instrutions below! You won't have to use sudo in the commands below, because your in your chroot as root anyway.