Android (Italiano)

From ArchWiki
Revision as of 17:43, 9 April 2012 by SirX (talk | contribs) (Continuo traduzione)
Jump to: navigation, search

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.

Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어

External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Tango-preferences-desktop-locale.pngThis article or section needs to be translated.Tango-preferences-desktop-locale.png

Notes: Questo articolo è in fase di traduzione. Seguite per ora le istruzioni della versione inglese. (Discuss in Talk:ArchWiki Translation Team (Italiano)#Pagine Marcate come "out of date" e "Traslateme")

Sviluppo Android su Arch

Ottenere SDK e i plugins IDE

(Se si sta usando Arch64, è necessario abilitare il repo multilib, per poter installare le dipendenze richieste usando pacman.)

Installare i componenti core SDK da AUR:

  1. android-sdkAUR
  2. android-sdk-platform-toolsAUR

Il luogo tipico di installazione è /opt/android-sdk.

Quando si usa Eclipse come IDE è necessario installare il plugin ADT e i pacchetti relativi. Se si riceve un messaggio riguardo a dipendenze irrisolvibili, installare Java manualmente e provare di nuovo. Altrimenti è possibile usare Netbeans for development after installing living and usually up to date plugin according to this instructions.

Impostare Eclipse

Molta roba richiesta per lo sviluppo Android in Eclipse è già pacchettizzata su AUR:

Official plugin by Google – Eclipse ADT:

  1. eclipse-androidAUR


  1. eclipse-emfAUR
  2. eclipse-gefAUR
  3. eclipse-wtp-wstAUR

Enter the path to the Android SDK Location in

Windows -> Preferences -> Android

Setting up Netbeans

If you prefer using Netbeans as your IDE and want to develop Android applications, download the nbandroid by going to:

Tools -> Plugins -> Settings

Add the following URL:

Then go to Available Plugins and install the Android and Android Test Runner plugins for your IDE version. Once you have installed go to:

Tools -> Options -> Miscellaneous -> Android

and select the path where the SDK is installed. That's it, now you can create a new Android project and start developing using Netbeans.

Android platforms

Prima di sviluppare applicazioni android è necessario almeno installare una piattaforma Android; questo può essere fatto sia automaticamente che manualmente.

Installazione automatica

L'installazione automatica viene fatta attraverso l'Android SDK e il gestore di dispositivi, che è accessibile richiamando (assumendo che la $PATH variabile contenga il percorso alla cartella tools dell'Android SDK):


o in alternativa:


Se l'installazione automatica dà errore allora è necessario o avviare il tool di Android con privilegi superiori o impostare il proprio account utente come proprietario della cartella. Per cambiare l'ID del proprietario per tutte le cartelle SDK, eseguire il seguente comando come amministratore:

 chown -R USER /opt/android-sdk

Per cambiare l'ID del gruppo, invece, (raccomandato per utenti multipli), prima bisogna creare il gruppo, probabilmente chiamato android, e aggiungere ad esso il proprio account:

 groupadd android
 gpasswd -a USER android

Next, change the directory permissions:

 chgrp -R android /opt/android-sdk
 chmod -R g+w /opt/android-sdk
 find /opt/android-sdk -type d -exec chmod g+s {} \;

Il comando finale imposta il bit setgid in tutte le sottocartelle, in modo che ogni nuovo file creato in esse riceva il giusto group ID.

Per un'installazione automatica passo-passo, si veda: Installare componenti SDK (en).

Getting from AUR

AUR currently contains multiple packages with Android platforms sometimes duplicating each other and/or having incorrect file permissions set. All are listed at android-sdkAUR page (see dependent packages list).

Manual installation

For manual installation:

  1. Download the platform you want to develop on. This site provides online links to several Android SDK components.
  2. Extract the tarball to /<path_to_android-sdk>/platforms.

Now, you should see the platform of your choice installed in the Installed Packages window of the Android SDK and device manager.

Android Debug Bridge (ADB) - Connecting to a real device

To get ADB to connect to a real device or phone under Arch, you must install the udev rules to connect the device to the proper /dev/ entries. This can be done manually, or you can use the AUR package android-udevAUR to use a common list of vendor IDs.

Each Android device has a USB vendor/product ID. An example for HTC Evo is:

vendor id: 0bb4
product id: 0c8d

Figure Out Your Device Ids

Plug in your device and execute:

# lsusb

It should come up something like this:

Bus 002 Device 006: ID 0bb4:0c8d High Tech Computer Corp.

Adding udev Rules

Use the following udev rules as a template, and replace [VENDOR ID] and [PRODUCT ID] with yours. Copy these rules into /etc/udev/rules.d/51-android.rules:

SUBSYSTEM=="usb", ATTR{idVendor}=="[VENDOR ID]", MODE="0666"
SUBSYSTEM=="usb",ATTR{idVendor}=="[VENDOR ID]",ATTR{idProduct}=="[PRODUCT ID]",SYMLINK+="android_adb"
SUBSYSTEM=="usb",ATTR{idVendor}=="[VENDOR ID]",ATTR{idProduct}=="[PRODUCT ID]",SYMLINK+="android_fastboot"

Then, to reload your new udev rules, execute:

# udevadm control --reload-rules

Does It Work?

After you have setup the udev rules, unplug your device and replug it.

After running:

$ adb devices

you should see something like:

List of devices attached 
HT07VHL00676    device

If you do not have the adb program (usually available in /opt/android-sdk/platform-tools/), it means you have not installed the platform tools.

If you are getting an empty list (your device isn't there), it may be because you have not enabled USB debugging on your device. You can do that by going to Settings => Applications => Development and enabling USB debugging.

You will have to start adb as root for the correct permissions to see the device. If adb is already running do

$ sudo adb kill-server
$ sudo adb start-server

Tools specific to NVIDIA Tegra platform

If you target your application at NVIDIA Tegra platform, you might also want to install tools, samples and documentation provided by NVIDIA. In NVIDIA Developer Zone for Mobile there are two packages - Tegra Android Development Pack, available from AUR as tegra-devpackAUR and Tegra Toolkit, available from AUR as tegra-toolkitAUR.

The tegra-toolkitAUR package provides tools (mostly CPU and GPU optimization related), samples and documentation, while the tegra-devpackAUR provides tools (NVIDIA Debug Manager) related to Eclipse ADT and their documentation.


See Android_Tethering

Tips & Tricks

During Debugging "Source not found"

Most probably the debugger wants to step into the Java code. As the source code of Android does not come with the Android SDK, this leads to an error. The best solution is to use step filters to not jump into the Java source code. Step filters are not activated by default. To activate them:

Window -> Preferences -> Java -> Debug -> Step Filtering

Consider to select them all. If appropriate you can add the android.* package. See the forum post for more information:

Linux distribution on the sdcard

You can install Debian like in this thread, or you can adapt it to install Arch Linux. You should replace all debootstrap stuff by:

mkdir -p /data/local/mnt/var/{cache/pacman/pkg,lib/pacman}
pacman --root /data/local/mnt --cachedir /data/local/mnt/var/cache/pacman/pkg -Sy base

Android SDK on Arch 64

When using the Android SDK and the Eclipse plugin on a 64 bit system, and the 'emulator' always crashes with a segfault, do the following: Provide a localtime file in /usr/share/zoneinfo/localtime e.g.:

 sudo cp /usr/share/zoneinfo/Europe/Berlin /usr/share/zoneinfo/localtime