App Android

Anbox è un minimalistico contenitore Android e livello di compatibilità che consente di eseguire app Android su sistemi operativi GNU/Linux come UBports.

Nota

Quando “host” è usato in questo documento, si riferisce ad un altro dispositivo al quale è possibile connettere il tuo dispositivo Ubuntu touch. Il tuo dispositivo host deve avere installato adb e fastboot.

Nota

Per installare Andbox e le APK dovrai eseguire dei comandi sul tuo dispositivo Ubuntu Touch. Puoi farlo usando l’applicazione terminale, ma è più facile usare adb shell o set up ssh per accedere al tuo telefono dal tuo host.

Dispositivi supportati

Assicurati che il tuo dispositivo sia supportato:

  • Meizu PRO 5

  • Fairphone 2

  • OnePlus One

  • Nexus 5

  • BQ Aquaris M10 HD

  • BQ Aquaris M10 FHD

Come installare

Avvertimento

L’installazione di Anbox è consigliata solo agli utenti esperti.

Install Anbox kernel

Some devices require you to install a custom Linux kernel to use Anbox. These devices are:

  • Meizu Pro 5 (nome in codice: turbo, nome della partizione di boot: bootimg)

  • BQ M10 HD (nome in codice: cooler, nome della partizione di boot: boot)

  • BQ M10 FHD (nome in codice: frieza, nome della partizione di boot: boot)

If your device is not in this list, the Anbox kernel was automatically installed when you installed Ubuntu Touch. Please skip to Run the Anbox installer.

You will need to repeat these steps after each Ubuntu Touch update. Not doing so can put your phone into an unstable state. Only update your Ubuntu Touch device when you have a computer with you to re-flash the modified kernel image.

  1. Be sure to have a backup of your device.

  2. Aprire un terminale (su host) e impostare alcune variabile specifiche per il dispositivo eseguendo export CODENAME="turbo" && export PARTITIONNAME="bootimg", sostituendo le parti tra virgolette, rispettivamente, con il “codename“ e il nome della partizione di boot del tuo dispositivo. Vedere la lista precedente.

  3. Attivare la modalità sviluppatore sul tuo dispositivo.

  4. Collega il dispositivo al tuo host e da questo host esegui il seguente comando (lo stesso terminale dal quale hai eseguito il comando export):

    wget http://cdimage.ubports.com/anbox-images/anbox-boot-$CODENAME.img
    adb shell # connect from your host computer to your UT device
    sudo reboot -f bootloader # 'adb shell' will exit after this command, the prompt will be back on your host
    sudo fastboot flash $PARTITIONNAME anbox-boot-$CODENAME.img
    sudo fastboot reboot
    rm anbox-boot-$CODENAME.img
    exit
    

Run the Anbox installer

Once your device has the Anbox kernel installed, you can use the Anbox Tool to install the Anbox container.

  1. Run adb shell from your host computer to get a shell on your Ubuntu Touch device.

  2. Run the following command on your Ubuntu Touch device: anbox-tool install.

  3. Follow the on-screen instructions.

Now you’re done! You might have to refresh the app drawer (pull down from the center of the screen and release) for the new Android apps to show up.

Nota

You now have an ADB server running on your Ubuntu Touch device. This guide asks you to run some adb commands, sometimes on your computer, other times on the device itself. Carefully check which device you are on!

You can check that ADB server is correctly running locally on your phone by opening the terminal app and enter adb devices. You should see something like:

phablet@ubuntu-phablet:~$ adb devices
List of devices attached
emulator-5558       device

Come installare nuove APK

  • Copiare la APK in /home/phablet/Downloads, quindi eseguire il seguente comando dal tuo host:

    adb shell # connect from your host computer to your UT device
    adb install /home/phablet/Downloads/my-app.apk # This is the adb of your device, not your host
    exit
    
  • Fatto! Può darsi che sia da ricaricare lo scope delle app (premere al centro dello schermo, trascinare verso il basso e poi rilasciare) affinché siano visualizzate le nuove app Android.

Mantenere le tue app aggiornate

Come disinstallare le app

  • Per disinstallare le applicazioni, eseguire adb uninstall [APP_ID] dal tuo dispositivo Ubuntu Touch:

    adb shell # connect from your host computer to your UT device
    sudo mount -o rw,remount /
    adb uninstall [APP_ID] # This is the adb of your device, not your host
    exit
    
  • Fatto! Può darsi che sia da ricaricare lo scope delle app (premere al centro dello schermo, trascinare verso il basso e poi rilasciare) affinché siano visualizzate le nuove app Android.

Spazio di archiviazione Android

Lo spazio di archiviazione Android si trova in /home/phablet/anbox-data/data/media/0.

  • È possibile creare collegamenti alle librerie Android nelle rispettive controparti XDG:

    ln -s ~/anbox-data/data/media/0/Documents ~/Documents/android
    ln -s ~/anbox-data/data/media/0/Pictures ~/Pictures/android
    ln -s ~/anbox-data/data/media/0/Music ~/Music/android
    ln -s ~/anbox-data/data/media/0/Movies ~/Videos/android
    

Risoluzione dei problemi

  • When you want to install an APK, but get the error Invalid APK file that error could also mean «file not found»

    • Check that you typed the filename correctly

    • Se l’APK non risiede nella cartella corrente dove esegui adb, devi specificarne il percorso completo, per esempio: /home/phablet/Downloads/my-app.apk invece di my-app.apk

Report di bug (bachi)

Per favore segnala eventuali bug in cui ti imbatti. I bug relativi a Ubuntu Touch 16.04 sono segnalati`nel normal Ubuntu Touch tracker <https://github.com/ubports/ubuntu-touch/issues>`_ e i problemi relativi ad Anbox sono segnalati nel nostro downstream fork. Grazie!