In the past week, I searched how to build the Nextcloud App only from the CLI but did not find. The solutions I found used Android Studio, which I find a little heavy. So I decided to build it with fdroid and share my experience.
Docker
All along this tutorial, I will be using the following docker image
https://hub.docker.com/r/runmymind/docker-android-sdk/.
If you want to install docker for your system see
https://docs.docker.com/install
Download the image sudo docker pull runmymind/docker-android-sdk
Run the image sudo docker run -it -v/your/working/directory/android:/data runmymind/docker-android-sdk /bin/bash
Where /your/working/directory/android could be for example /home/michel/Projects/android
Debug mode
Building the app in debug mode is the easiest way to build the app
cd /data-
git clone https://github.com/nextcloud/android --recursiveto clone the repo cd android-
./gradlew assembleDebugto build it
Your apk file will be located in build/outputs/apk/debug/
Release mode | EDIT : The following part is useless please see the other section
The release mode is much more complicated due to some Google Service
dependencies. The recommended way to build it is with Android Studio 3, if you
try with gradle you will have the same problems as specified here
cd /datagit clone https://gitlab.com/fdroid/fdroiddata-
git clone https://github.com/f-droid/fdroidserver && export PATH=$PATH:/data/fdroidserverto install the last fdroid version wget https://services.gradle.org/distributions/gradle-4.7-bin.zip-
unzip gradle-4.7-bin.zip && export PATH=$PATH:/data/gradle-4.7/binto install the last gradle version -
apt-get install aapt adb android-libaapt android-libadb android-libandroidfw android-libbacktrace android-libbase android-libcutils android-liblog android-libunwind android-libutils android-libziparchive android-sdk-platform-tools-common default-jdk-headless default-jre-headless dh-python libccid libpopt0 libprotobuf-lite10 libpython3-stdlib libusb-1.0-0 libwebp6 libwebpmux3 libyaml-0-2 libzopfli1 opensc opensc-pkcs11 p7zip p7zip-full pcscd python3 python3-args python3-asn1crypto python3-certifi python3-cffi-backend python3-chardet python3-clint python3-crypto python3-cryptography python3-git python3-gitdb python3-idna python3-libcloud python3-lockfile python3-minimal python3-olefile python3-paramiko python3-pil python3-pkg-resources python3-pyasn1 python3-pyasn1-modules python3-requests python3-simplejson python3-six python3-smmap python3-urllib3 python3-yaml python3.6 python3.6-minimal rsync zipalignto install fdroid’s dependencies cd fdroiddata-
fdroid init && fdroid readmetawhich init fdroid -
fdroid build -l com.nextcloud.clientto build the project -
fdroid publishto generate a signed apk
Your apk file will be located in repo/
Release | New version
-
git clone https://github.com/nextcloud/android --recursiveto clone the repo cd android-
./gradlew assembleGenericReleaseto build it
Your apk file will be located in build/outputs/apk/release
I hope this will help someone.
. I was able to run it by copy/pasting: