Approccio CLI
Testato su Ubuntu 15.10, Android 22.
Uno il dispositivo:
Poi:
sudo apt-get install ant gradle openjdk-7-jdk
cd
# Get device permissions.
# MANUAL find vendor ID on this table: http://developer.android.com/tools/device.html#VendorIds
# http://stackoverflow.com/a/5510745/895245
VENDOR_ID='054c'
UDEV_PATH='/etc/udev/rules.d/51-android.rules'
echo 'SUBSYSTEM=="usb", ATTR'"$VENDOR_ID"'=="0bb4", MODE="0666", GROUP="plugdev"' | sudo tee "$UDEV_PATH"
sudo chmod a+r "$UDEV_PATH"
sudo /etc/init.d/udev restart
wget http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
tar -xvf android-sdk_r24.4.1-linux.tgz
# MANUAL run the ./tools/android GUI and install the SDK versions you need
# Better: just download EVERYTHING to save you annoyances later on.
# Yes, it takes a ton of space (50Gib+).
# http://stackoverflow.com/questions/17963508/how-to-install-android-sdk-build-tools-on-the-command-line
# The automated command line should look something like:
#API=22
#N="$(android list sdk --all |& grep 'SDK Platform Android' | grep "API $API" | cut -d- -f1)"
#android update sdk -u -a -t $N
# Studio
wget https://dl.google.com/dl/android/studio/ide-zips/1.5.1.0/android-studio-ide-141.2456560-linux.zip
unzip android-studio-ide-141.2456560-linux.zip
cd android-studio/bin
./studio.sh
# NDK
wget http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin
chmod a+x android-ndk-r10e-linux-x86_64.bin
./android-ndk-r10e-linux-x86_64.bin
mv android-ndk-r10e android-ndk
Aggiungi a ~/.profile
: TODO: quali di quelli sono effettivamente necessari?
export ANDROID_SDK="$HOME/android-sdk"
# Present on the default build.xml generated by "android create project [...] in Android 22.
export ANDROID_HOME="$ANDROID_SDK"
export ANDROID_NDK="$HOME/android-ndk"s
export ANDROID_NDK_ROOT="$ANDROID_NDK"
# Used by https://github.com/googlesamples/android-ndk/tree/3cd41e1f5280443665ca98463c7a76e80bf0b96c/native-codec
export ANDROID_NDK_HOME="$ANDROID_NDK"
export ANDROID_ABI='armeabi-v7a'
export ANDROID_JAVA_HOME="$JAVA_HOME"
export ANDROID_STUDIO="$HOME/android-studio/"
export PATH="$ANDROID_SDK/platform-tools:$ANDROID_SDK/tools:${ANDROID_STUDIO}/bin:${ANDROID_NDK}:${PATH}"
Esci e accedi. Potresti aver bisogno:
sudo "$(which adb)" kill-server
sudo "$(which adb)" start-server
Prova l'installazione
Metti le mani su un progetto minimale come questo o guarda sotto $ANDROID_SDK/samples/
.
Se si tratta di un progetto Ant (contiene un build.xml
file), esegui:
ant debug
ant installd
Se si tratta di un progetto Gradle (contiene un gradlew
file), eseguire:
./gradlew assembleDebug
./gradlew installDebug
L'app dovrebbe essere installata sul tuo dispositivo.
Studio (successore di ADT) può essere lanciato con:
studio.sh
Gli esempi NDK sono disponibili sotto $ANDROID_NDK/samples
e puoi crearli e installarli con:
ndk-build
# Create build.xml, as per: http://stackoverflow.com/questions/5572304/how-to-build-the-android-sample-projectsusing-ant-build-xml-does-not-exist
android update project -p . -t android-22
ant clean
ant debug
ant installd
Stato dei pacchetti Debian ufficiali
Al momento non esiste un pacchetto Debian ufficiale.
Ma c'è un progetto Google Summer of Code 2015 che cerca di risolverlo: https://www.google-melange.com/gsoc/project/details/google/gsoc2015/seamlik/5707702298738688