Abordagem CLI
Testado no Ubuntu 15.10, Android 22.
Um o dispositivo:
Então:
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
Adicione ao seu ~/.profile
: TODO: quais são realmente necessárias?
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}"
Logout e login. Você pode precisar:
sudo "$(which adb)" kill-server
sudo "$(which adb)" start-server
Teste a instalação
Ponha as mãos em um projeto mínimo como este ou veja abaixo $ANDROID_SDK/samples/
.
Se for um projeto Ant (contém um build.xml
arquivo), execute:
ant debug
ant installd
Se for um projeto Gradle (contém um gradlew
arquivo), execute:
./gradlew assembleDebug
./gradlew installDebug
O aplicativo deve estar instalado no seu dispositivo.
O Studio (sucessor do ADT) pode ser iniciado com:
studio.sh
As amostras NDK podem ser encontradas em $ANDROID_NDK/samples
e você pode compilá-las e instalá-las com:
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
Estado dos pacotes oficiais do Debian
Atualmente não há pacote oficial do Debian.
Mas há um projeto do Google Summer of Code 2015 tentando resolver isso: https://www.google-melange.com/gsoc/project/details/google/gsoc2015/seamlik/5707702298738688