Category Archives: Android

Using An Android Smartphone As A WLAN Hotspot

Using An Android Smartphone As A WLAN Hotspot

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot]
com>, Christian Schmalfeld  <c [dot] schmalfeld [at]
projektfarm [dot] de>
Follow me on Twitter

Last edited 08/17/2011

To access Wireless LAN you usually need
to find a so-called hotspot where you can use the local Wireless LAN to
access the Internet. Android smartphones however have a feature which
enables them to become a wireless hotspot themselves – they use UMTS to connect to the Internet and make the Internet connection available to other computers/devices via WLAN. This article
describes how you can configure this feature.

I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

The screenshots taken for this tutorial originate from a HTC Desire A8181
Android smartphone and the Linux Mint 11 operating system. The
tutorial’s steps may differ a little if you use other devices or
operating systems, but the main procedure remains the same for similar
ones. It should be noted however, that the Wi-Fi Hotspot function is available only on Android 2.2 (Froyo) and newer!

 

2 Configuring The Wi-Fi Hotspot

To make your smartphone a wireless hotspot, browse Apps > Settings > Wireless & Networks.

Make sure to uncheck Wi-Fi. Scroll down and check Mobile network instead. It should switch to Connected
then. These changes should automatically be applied when the hotspot is
being activated, but to be on the safe side we do it manually before we
proceed.

Tap on Portable Wi-Fi hotspot settings next.

Choose your SSID (the name the network will be displayed on your
computer), the type of security protocol (WPA2 is safer than WEP, so
select this) and your password. The password I used is very unsafe, be
sure to pick one that one cannot figure out easily since the hotspot is
accessible to every wireless device around it. Confirm by checking the Press to turn on box.

Read the instructions carefully and proceed by hitting OK. The wireless hotspot should now be displayed as Ready.

It should also be checked as Active in the Wireless & Networks section.

You are now finished configuring the wireless hotspot. Proceed by
connecting your computer to the network using a wireless adapter or
similar hardware.

3 Connecting To The Hotspot

Browse your networks to find the network by the given name and click on
it to connect. You will then be asked for the security protocol and
your password.

It may occur that you do not have the option to select the protocol you
told the smartphone to use. In that case, browse your networks again
and click the Edit Connections… panel.

Go to the Wireless tab and the select the network by the given name. Click Edit to configure the available protocols.

Browse the Wireless Security tab and select the chosen security protocol from the dropdown menu. Enter your password and click on Save.

If you try to connect to the hotspot once again, your protocol should be available in the list. Enter your password and click Connect to access the Internet with your selfmade wireless hotspot.

Copyright © 2011 Christian
All Rights Reserved.

Apache2: How To Redirect Users To Mobile Or Normal Web Site Based On Device Using mod_rewrite

Apache2: How To Redirect Users To Mobile Or Normal Web Site Based On Device Using mod_rewrite

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Follow me on Twitter
Last edited 08/24/2011

Since the massive rise of smartphones and tablets like the iPhone, iPad, Android phones and tablets, BlackBerries, etc. you might have considered creating a mobile version of your web site. This tutorial explains how to configure Apache to serve the mobile version of your web site if the visitor uses a mobile device, and the normal version if the visitor uses a normal desktop PC. This can be achieved with Apache’s rewrite module.

I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

In this tutorial, my “normal” web site is accessible under http://www.example.com and http://example.com, while my mobile site is called http://m.example.com. These vhosts already exist on my system, so I’m not going to cover how to set them up.

 

2 Enabling mod_rewrite

First you have to make sure that the Apache module mod_rewrite is enabled. On Debian/Ubuntu, you can enable it like this:

a2enmod rewrite

Restart Apache afterwards – for Debian/Ubuntu, the command is:

/etc/init.d/apache2 restart

 

3 Configuring Apache To Allow Rewrite Rules In .htaccess Files

My “normal” web site www.example.com/example.com has the vhost configuration file /etc/apache2/sites-available/www.example.com.vhost and the document root /var/www/www.example.com/web.

My mobile site m.example.com has the vhost configuration file /etc/apache2/sites-available/m.example.com.vhost and the document root /var/www/www.example.com/mobile.

I want to place the rewrite rules for each site in an .htaccess file (although it is also possible to place the rewrite rules directly in the vhost configuration file). Therefore I must first modify our vhost configurations so that both .htaccess files are allowed to contain rewrite directives. We can do this with the line AllowOverride All (which allows .htaccess to override all settings in the vhost configuration):

vi /etc/apache2/sites-available/www.example.com.vhost

[...]
        <Directory /var/www/www.example.com/web/>
                AllowOverride All
	</Directory>
[...]

vi /etc/apache2/sites-available/m.example.com.vhost

[...]
        <Directory /var/www/www.example.com/mobile/>
                AllowOverride All
        </Directory>
[...]

Restart Apache afterwards:

/etc/init.d/apache2 restart

 

4 Creating Rewrite Rules

Now let’s create the rewrite rules for the “normal” web site www.example.com/example.com that will redirect all users of mobile devices to the mobile version m.example.com – I focus on the relevant devices/user agents here which are Android, Blackberry, googlebot-mobile (Google’s mobile search bot), IE Mobile, iPad, iPhone, iPod, Opera Mobile, PalmOS, and WebOS.

The /var/www/www.example.com/web/.htaccess file looks as follows:

vi /var/www/www.example.com/web/.htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos" [NC]
RewriteRule ^$ http://m.example.com/ [L,R=302]
</IfModule>

For our mobile web site m.example.com, the rewrite rules that redirect all users that don’t use a mobile device to our “normal” web site www.example.com/example.com look as follows – I’ve simply negated the RewriteCond condition from the previous .htaccess file:

vi /var/www/www.example.com/mobile/.htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} "!(android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos)" [NC]
RewriteRule ^$ http://www.example.com/ [L,R=302]
</IfModule>

That’s it! Now you can do some testing, e.g. visit m.example.com with a normal desktop browser:

If all goes well, you should be redirected to www.example.com:

Now test with a mobile device (I use an Android phone here) and go to www.example.com:

You should be redirected to m.example.com:

 

5 Links

  • Apache: http://httpd.apache.org/
  • Apache Module mod_rewrite: http://httpd.apache.org/docs/current/mod/mod_rewrite.html

Copyright © 2011 Falko Timme
All Rights Reserved.

Using An Android Smartphone As A WLAN Hotspot

Using An Android Smartphone As A WLAN Hotspot

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot]
com>, Christian Schmalfeld  <c [dot] schmalfeld [at]
projektfarm [dot] de>
Follow me on Twitter

Last edited 08/17/2011

To access Wireless LAN you usually need
to find a so-called hotspot where you can use the local Wireless LAN to
access the Internet. Android smartphones however have a feature which
enables them to become a wireless hotspot themselves – they use UMTS to connect to the Internet and make the Internet connection available to other computers/devices via WLAN. This article
describes how you can configure this feature.

I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

The screenshots taken for this tutorial originate from a HTC Desire A8181
Android smartphone and the Linux Mint 11 operating system. The
tutorial’s steps may differ a little if you use other devices or
operating systems, but the main procedure remains the same for similar
ones. It should be noted however, that the Wi-Fi Hotspot function is available only on Android 2.2 (Froyo) and newer!

 

2 Configuring The Wi-Fi Hotspot

To make your smartphone a wireless hotspot, browse Apps > Settings > Wireless & Networks.

Make sure to uncheck Wi-Fi. Scroll down and check Mobile network instead. It should switch to Connected
then. These changes should automatically be applied when the hotspot is
being activated, but to be on the safe side we do it manually before we
proceed.

Tap on Portable Wi-Fi hotspot settings next.

Choose your SSID (the name the network will be displayed on your
computer), the type of security protocol (WPA2 is safer than WEP, so
select this) and your password. The password I used is very unsafe, be
sure to pick one that one cannot figure out easily since the hotspot is
accessible to every wireless device around it. Confirm by checking the Press to turn on box.

Read the instructions carefully and proceed by hitting OK. The wireless hotspot should now be displayed as Ready.

It should also be checked as Active in the Wireless & Networks section.

You are now finished configuring the wireless hotspot. Proceed by
connecting your computer to the network using a wireless adapter or
similar hardware.

3 Connecting To The Hotspot

Browse your networks to find the network by the given name and click on
it to connect. You will then be asked for the security protocol and
your password.

It may occur that you do not have the option to select the protocol you
told the smartphone to use. In that case, browse your networks again
and click the Edit Connections… panel.

Go to the Wireless tab and the select the network by the given name. Click Edit to configure the available protocols.

Browse the Wireless Security tab and select the chosen security protocol from the dropdown menu. Enter your password and click on Save.

If you try to connect to the hotspot once again, your protocol should be available in the list. Enter your password and click Connect to access the Internet with your selfmade wireless hotspot.

Copyright © 2011 Christian
All Rights Reserved.

Android Smartphone USB Tethering (Linux Mint 11)

Android Smartphone USB Tethering (Linux Mint 11)

Version 1.0
Author: Christian Schmalfeld  <c [dot] schmalfeld [at]
projektfarm [dot] de>
Last edited 08/24/2011

This
article is about how to tether your Android smartphone with Linux Mint
11 and similar operating systems via USB, meaning how to use your
smartphone’s network to access the Internet on your computer by linking
them with a USB cable.

This tutorial comes without warranty of any kind.

 

1 Preliminary Note

The smartphone I use in this tutorial is the HTC Desire A8181, the
screenshots originate from the same model. The guide should work for
similar smartphones with Android installed. No extra software is needed
to enable USB tethering on Linux Mint.

 

2 Setting Up USB Tethering On Your Phone

To access the Internet on your computer using your phone’s network,
first make sure the smartphone itself has a connection to a mobile
network. If it does not, enable that first. If your phone is able to
connect to a mobile network, go to Menu > Settings > Wireless & networks
and make sure that Mobile network is turned on.

Having done that, plug your phone into your computer via USB. If
your phone was turned on while doing so, the following screen will
appear.

Choose USB tethering and tap Done. If that kind of screen does not show up while plugging in, or you plugged it in and turned it off, turn your phone on and go to Menu > Settings > Wireless & networks and enable USB tethering manually.

Your computer should now automatically connect to your phone’s network. Please notice that it is not possible to take screenshots of your
smartphone with Dalvik Debug Monitor while tethering. Tethering must
first be disabled before your phone appears on the list of devices
again.

You can see the connection by clicking on the networks symbol on the bottom right corner of the screen:

Copyright © 2011 Christian
All Rights Reserved.

ISPConfig Monitor App For Android

ISPConfig Monitor App For Android

The ISPConfig Monitor App is for all servers, not only for servers running ISPConfig. With the ISPConfig Monitor App, you can check your server status and find out if all services are running as expected. You can check TCP and UDP ports and ping your servers. In addition to that you can use this app to request details from servers that have ISPConfig installed (please note that the minimum installed ISPConfig 3 version with support for the ISPConfig Monitor App is 3.0.3.3!); these details include everything you know from the Monitor module in the ISPConfig Control Panel (e.g. services, mail and system logs, mail queue, CPU and memory info, disk usage, quota, OS details, RKHunter log, etc.), and of course, as ISPConfig is multiserver-capable, you can check all servers that are controlled from your ISPConfig master server.

 

Price

The ISPConfig Monitor App is available for EUR 3.99.

 

Download/Usage

For download and usage instructions, please visit http://www.ispconfig.org/ispconfig-3/ispconfig-monitor-app-for-android/.

Copyright © 2011 HowtoForge Team
All Rights Reserved.

Setting Up An Android App Build Environment With Eclipse, Android SDK, PhoneGap (Debian Squeeze)

Setting Up An Android App Build Environment With Eclipse, Android SDK, PhoneGap (Debian Squeeze)

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Follow me on Twitter
Last edited 03/02/2011

This tutorial describes how you can set up an development environment for building Android apps on a Debian Squeeze desktop using Eclipse, the Android SDK, and PhoneGap. I will describe how to build Android apps from the command line with PhoneGap and from the GUI with Eclipse and PhoneGap and how to test them in an Android emulator and on a real Android device. PhoneGap allows you to develop your Android applications using web technologies such as HTML, CSS, and JavaScript (e.g. with JavaScript libraries such as jQuery/jQTouch), and it will turn these web apps into native Android apps (in fact, PhoneGap supports multiple platforms such as Android, iPhone, Palm, Windows Mobile, Symbian, so you can use the same sources to create apps for multiple platforms).

I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

I will not explain how to develop an Android app using HTML, CSS, and JavaScript. You can find lots of tutorials about this on the Internet, e.g. this one:

Tutorial: A simple Twitter client with JQTouch

In fact, I’m using a slightly modified version of the Twitter client described in the link to build a Twitter app in this tutorial.

 

2 Installing Eclipse And Prerequisites For The Android SDK/PhoneGap

First open a terminal (Applications > Accessories > Terminal):

Become root:

su

Eclipse and the prerequisites for the Android SDK and PhoneGap can be installed as follows:

apt-get install openjdk-6-jdk eclipse ruby rubygems ruby-dev libnokogiri-ruby git ant libxml2 libxml2-dev libxslt-dev

If you are on a 64bit system, you also need to install the following two packages:

apt-get install lib32stdc++6 ia32-libs

Type

exit

afterwards to leave the root shell and become a normal user again.

 

3 Installing The Android SDK

Open Iceweasel/Firefox and go to http://developer.android.com/sdk/index.html. There you will find links for the Android SDK for the different platforms (Windows, Mac OS X, Linux). Copy the link location of the download for Linux (i386) (don’t worry, this download works on both i386 and x86_64 platforms!)…

… and download and uncompress it as follows:

cd ~
wget http://dl.google.com/android/android-sdk_r10-linux_x86.tgz
tar xvfz android-sdk_r10-linux_x86.tgz

This will give you the directory android-sdk-linux_x86 in your home directory ($HOME). We must add the $HOME/android-sdk-linux_x86/tools directory and the $HOME/android-sdk-linux_x86/platform-tools directory to our PATH variable which we do as follows:

Open ~/.profile

gedit ~/.profile

… and add the following line at the bottom of the file:

[...]
PATH="$HOME/android-sdk-linux_x86/tools:$HOME/android-sdk-linux_x86/platform-tools:$PATH"

To make the change effective (so that we don’t have to log out and back in), run:

export PATH=”$HOME/android-sdk-linux_x86/tools:$HOME/android-sdk-linux_x86/platform-tools:$PATH”

Now start the Android SDK:

android

This is how the Android SDK looks:

Select Available packages in the left panel and then select Android Repository in the right panel to download SDK packages:

The packages that belong to the Android Repository group should now all be checked. Click on the Install Selected button:

A new window opens; mark the Accept radio box and click on Install

… to start the download of the SDK packages:

If ADB (Android Debug Bridge) needs to be restarted, click on Yes:

Click on Close after the download has finished – this will close the download window:

  • Setting Up An Android App Build Environment With Eclipse, Android SDK, PhoneGap (Debian Squeeze) – Page 2
  • Setting Up An Android App Build Environment With Eclipse, Android SDK, PhoneGap (Debian Squeeze) – Page 3
  • Setting Up An Android App Build Environment With Eclipse, Android SDK, PhoneGap (Debian Squeeze) – Page 4
  • Setting Up An Android App Build Environment With Eclipse, Android SDK, PhoneGap (Debian Squeeze) – Page 5

next Setting Up An Android App Build Environment With Eclipse, Android SDK, PhoneGap (Debian Squeeze) – Page 2
Copyright © 2011 Falko Timme
All Rights Reserved.

Related Tutorials

Setting Up An Android App Build Environment With Eclipse, Android SDK, PhoneGap (Ubuntu 10.10)

Setting Up An Android App Build Environment With Eclipse, Android SDK, PhoneGap (Ubuntu 10.10)

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Follow me on Twitter
Last edited 01/24/2011

This tutorial describes how you can set up a development environment for building Android apps on an Ubuntu 10.10 desktop using Eclipse, the Android SDK, and PhoneGap. I will describe how to build Android apps from the command line with PhoneGap and from the GUI with Eclipse and PhoneGap and how to test them in an Android emulator and on a real Android device. PhoneGap allows you to develop your Android applications using web technologies such as HTML, CSS, and JavaScript (e.g. with JavaScript libraries such as jQuery/jQTouch), and it will turn these web apps into native Android apps (in fact, PhoneGap supports multiple platforms such as Android, iPhone, Palm, Windows Mobile, Symbian, so you can use the same sources to create apps for multiple platforms).

I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

I will not explain how to develop an Android app using HTML, CSS, and JavaScript. You can find lots of tutorials about this on the Internet, e.g. this one:

Tutorial: A simple Twitter client with JQTouch

In fact, I’m using a slightly modified version of the Twitter client described in the link to build a Twitter app in this tutorial.

 

2 Installing Eclipse And Prerequisites For The Android SDK/PhoneGap

First open a terminal (Applications > Accessories > Terminal):

Eclipse and the prerequisites for the Android SDK and PhoneGap can be installed as follows:

sudo apt-get install openjdk-6-jdk eclipse ruby rubygems ruby-dev git ant libxml2 libxml2-dev libxslt-dev

Next run

sudo gem install nokogiri

 

3 Installing The Android SDK

Open Firefox and go to http://developer.android.com/sdk/index.html. There you will find links for the Android SDK for the different platforms (Windows, Mac OS X, Linux). Copy the link location of the download for Linux (i386) (don’t worry, this download works on both i386 and x86_64 platforms!)…

… and download and uncompress it as follows:

cd ~
wget http://dl.google.com/android/android-sdk_r08-linux_86.tgz
tar xvfz android-sdk_r08-linux_86.tgz

This will give you the directory android-sdk-linux_86 in your home directory ($HOME). We must add the $HOME/android-sdk-linux_86/tools directory and the $HOME/android-sdk-linux_86/platform-tools directory to our PATH variable which we do as follows:

Open ~/.profile

gedit ~/.profile

… and add the following line at the bottom of the file:

[...]
PATH="$HOME/android-sdk-linux_86/tools:$HOME/android-sdk-linux_86/platform-tools:$PATH"

To make the change effective (so that we don’t have to log out and back in), run:

export PATH=”$HOME/android-sdk-linux_86/tools:$HOME/android-sdk-linux_86/platform-tools:$PATH”

Now start the Android SDK:

android

This is how the Android SDK looks:

Select Available packages in the left panel and then select Android Repository in the right panel to download SDK packages:

The packages that belong to the Android Repository group should now all be checked. Click on the Install Selected button:

A new window opens; mark the Accept radio box and click on Install

… to start the download of the SDK packages:

If ADB (Android Debug Bridge) needs to be restarted, click on Yes:

Click on Close after the download has finished – this will close the download window:

  • Setting Up An Android App Build Environment With Eclipse, Android SDK, PhoneGap (Ubuntu 10.10) – Page 2
  • Setting Up An Android App Build Environment With Eclipse, Android SDK, PhoneGap (Ubuntu 10.10) – Page 3
  • Setting Up An Android App Build Environment With Eclipse, Android SDK, PhoneGap (Ubuntu 10.10) – Page 4
  • Setting Up An Android App Build Environment With Eclipse, Android SDK, PhoneGap (Ubuntu 10.10) – Page 5

next Setting Up An Android App Build Environment With Eclipse, Android SDK, PhoneGap (Ubuntu 10.10) – Page 2
Copyright © 2011 Falko Timme
All Rights Reserved.

Using An Android Smartphone As A WLAN Hotspot

Using An Android Smartphone As A WLAN Hotspot

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot]
com>, Christian Schmalfeld  <c [dot] schmalfeld [at]
projektfarm [dot] de>
Follow me on Twitter

Last edited 08/17/2011

To access Wireless LAN you usually need
to find a so-called hotspot where you can use the local Wireless LAN to
access the Internet. Android smartphones however have a feature which
enables them to become a wireless hotspot themselves – they use UMTS to connect to the Internet and make the Internet connection available to other computers/devices via WLAN. This article
describes how you can configure this feature.

I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

The screenshots taken for this tutorial originate from a HTC Desire A8181
Android smartphone and the Linux Mint 11 operating system. The
tutorial’s steps may differ a little if you use other devices or
operating systems, but the main procedure remains the same for similar
ones. It should be noted however, that the Wi-Fi Hotspot function is available only on Android 2.2 (Froyo) and newer!

 

2 Configuring The Wi-Fi Hotspot

To make your smartphone a wireless hotspot, browse Apps > Settings > Wireless & Networks.

Make sure to uncheck Wi-Fi. Scroll down and check Mobile network instead. It should switch to Connected
then. These changes should automatically be applied when the hotspot is
being activated, but to be on the safe side we do it manually before we
proceed.

Tap on Portable Wi-Fi hotspot settings next.

Choose your SSID (the name the network will be displayed on your
computer), the type of security protocol (WPA2 is safer than WEP, so
select this) and your password. The password I used is very unsafe, be
sure to pick one that one cannot figure out easily since the hotspot is
accessible to every wireless device around it. Confirm by checking the Press to turn on box.

Read the instructions carefully and proceed by hitting OK. The wireless hotspot should now be displayed as Ready.

It should also be checked as Active in the Wireless & Networks section.

You are now finished configuring the wireless hotspot. Proceed by
connecting your computer to the network using a wireless adapter or
similar hardware.

3 Connecting To The Hotspot

Browse your networks to find the network by the given name and click on
it to connect. You will then be asked for the security protocol and
your password.

It may occur that you do not have the option to select the protocol you
told the smartphone to use. In that case, browse your networks again
and click the Edit Connections… panel.

Go to the Wireless tab and the select the network by the given name. Click Edit to configure the available protocols.

Browse the Wireless Security tab and select the chosen security protocol from the dropdown menu. Enter your password and click on Save.

If you try to connect to the hotspot once again, your protocol should be available in the list. Enter your password and click Connect to access the Internet with your selfmade wireless hotspot.

Copyright © 2011 Christian
All Rights Reserved.

Android Smartphone USB Tethering (Linux Mint 11)

Android Smartphone USB Tethering (Linux Mint 11)

Version 1.0
Author: Christian Schmalfeld  <c [dot] schmalfeld [at]
projektfarm [dot] de>
Last edited 08/24/2011

This
article is about how to tether your Android smartphone with Linux Mint
11 and similar operating systems via USB, meaning how to use your
smartphone’s network to access the Internet on your computer by linking
them with a USB cable.

This tutorial comes without warranty of any kind.

 

1 Preliminary Note

The smartphone I use in this tutorial is the HTC Desire A8181, the
screenshots originate from the same model. The guide should work for
similar smartphones with Android installed. No extra software is needed
to enable USB tethering on Linux Mint.

 

2 Setting Up USB Tethering On Your Phone

To access the Internet on your computer using your phone’s network,
first make sure the smartphone itself has a connection to a mobile
network. If it does not, enable that first. If your phone is able to
connect to a mobile network, go to Menu > Settings > Wireless & networks
and make sure that Mobile network is turned on.

Having done that, plug your phone into your computer via USB. If
your phone was turned on while doing so, the following screen will
appear.

Choose USB tethering and tap Done. If that kind of screen does not show up while plugging in, or you plugged it in and turned it off, turn your phone on and go to Menu > Settings > Wireless & networks and enable USB tethering manually.

Your computer should now automatically connect to your phone’s network. Please notice that it is not possible to take screenshots of your
smartphone with Dalvik Debug Monitor while tethering. Tethering must
first be disabled before your phone appears on the list of devices
again.

You can see the connection by clicking on the networks symbol on the bottom right corner of the screen:

Copyright © 2011 Christian
All Rights Reserved.

Setting Up An Android App Build Environment With Eclipse, Android SDK, PhoneGap (Ubuntu 11.04)

Setting Up An Android App Build Environment With Eclipse, Android SDK, PhoneGap (Ubuntu 11.04)

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Follow me on Twitter
Last edited 06/22/2011

This tutorial describes how you can set up an development environment for building Android apps on an Ubuntu 11.04 desktop using Eclipse, the Android SDK, and PhoneGap. I will describe how to build Android apps from the command line with PhoneGap and from the GUI with Eclipse and PhoneGap and how to test them in an Android emulator and on a real Android device. PhoneGap allows you to develop your Android applications using web technologies such as HTML, CSS, and JavaScript (e.g. with JavaScript libraries such as jQuery/jQTouch), and it will turn these web apps into native Android apps (in fact, PhoneGap supports multiple platforms such as Android, iPhone, Palm, Windows Mobile, Symbian, so you can use the same sources to create apps for multiple platforms).

I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

I will not explain how to develop an Android app using HTML, CSS, and JavaScript. You can find lots of tutorials about this on the Internet, e.g. this one:

Tutorial: A simple Twitter client with JQTouch

In fact, I’m using a slightly modified version of the Twitter client described in the link to build a Twitter app in this tutorial. You can download my modified version from here: http://downloads.howtoforge.com/android_build_environment/tweetme.zip

I’m working with the Ubuntu Classic desktop here (GNOME); the steps should almost be identical if you use Unity.

 

2 Installing Eclipse And Prerequisites For The Android SDK/PhoneGap

First open a terminal (Applications > Accessories > Terminal):

Eclipse and the prerequisites for the Android SDK and PhoneGap can be installed as follows:

sudo apt-get install openjdk-6-jdk eclipse ruby rubygems ruby-dev libnokogiri-ruby git ant libxml2 libxml2-dev libxslt1-dev

If you are on a 64bit system, you also need to install the following two packages:

sudo apt-get install lib32stdc++6 ia32-libs

 

3 Installing The Android SDK

Open Firefox and go to http://developer.android.com/sdk/index.html. There you will find links for the Android SDK for the different platforms (Windows, Mac OS X, Linux). Copy the link location of the download for Linux (i386) (don’t worry, this download works on both i386 and x86_64 platforms!)…

… and download and uncompress it as follows:

cd ~
wget http://dl.google.com/android/android-sdk_r11-linux_x86.tgz
tar xvfz android-sdk_r11-linux_x86.tgz

This will give you the directory android-sdk-linux_x86 in your home directory ($HOME). We must add the $HOME/android-sdk-linux_x86/tools directory and the $HOME/android-sdk-linux_x86/platform-tools directory to our PATH variable which we do as follows:

Open ~/.profile

gedit ~/.profile

… and add the following line at the bottom of the file:

[...]
PATH="$HOME/android-sdk-linux_x86/tools:$HOME/android-sdk-linux_x86/platform-tools:$PATH"

To make the change effective (so that we don’t have to log out and back in), run:

export PATH=”$HOME/android-sdk-linux_x86/tools:$HOME/android-sdk-linux_x86/platform-tools:$PATH”

Now start the Android SDK:

android

This is how the Android SDK looks:

Select Available packages in the left panel and then select Android Repository in the right panel to download SDK packages:

The packages that belong to the Android Repository group should now all be checked. Click on the Install Selected button:

A new window opens; mark the Accept radio box and click on Install

… to start the download of the SDK packages:

If ADB (Android Debug Bridge) needs to be restarted, click on Yes:

Click on Close after the download has finished – this will close the download window:

  • Setting Up An Android App Build Environment With Eclipse, Android SDK, PhoneGap (Ubuntu 11.04) – Page 2
  • Setting Up An Android App Build Environment With Eclipse, Android SDK, PhoneGap (Ubuntu 11.04) – Page 3
  • Setting Up An Android App Build Environment With Eclipse, Android SDK, PhoneGap (Ubuntu 11.04) – Page 4
  • Setting Up An Android App Build Environment With Eclipse, Android SDK, PhoneGap (Ubuntu 11.04) – Page 5

next Setting Up An Android App Build Environment With Eclipse, Android SDK, PhoneGap (Ubuntu 11.04) – Page 2
Copyright © 2011 Falko Timme
All Rights Reserved.