These instructions will help you to set up your development environment, get the source code of the ownCloud for Android app and build it by yourself. If you want to help developing the app take a look to the contribution guidelines.
Sections 1) and 2) are common for any environment. The rest of the sections describe how to set up a project in different tool environments. Choose the build tool or IDE you prefer and follow the instructions in its specific section. Nowadays we recommend to use Android Studio (section 2), but the decision is up to you.
If you have any problem, remove the 'android' folder, start again from 1) and work your way down. If something still does not work as described here, please open a new issue describing exactly what you did, what happened, and what should have happened.
There are some tools needed, no matter what is your specific IDE or build tool of preference.
git is used to access to the different versions of the ownCloud's source code. Download and install the version appropiate for your operating system from here. Add the full path to the 'bin/' directory from your git installation into the PATH variable of your environment so that it can be used from any location.
The Android SDK is necessary to build the app. There are different options to install it in your system, depending of the IDE you decide to use. Check Google documentation about installation for more details on these options. After installing it, add the full path to the directories 'tools/' and 'platform-tools/' from your Android SDK installation into the PATH variable of your environment.
Open a terminal and type 'android' to start the Android SDK Manager. To build the ownCloud for Android app you will need to install at least the next SDK packages:
Install any other package you consider interesting, such as emulators.
For other software dependencies check the details in the section corresponding to your preferred IDE or build system.
You will need git to access to the different versions of the ownCloud's source code. The source code is hosted in Github and may be read by anybody without needing a Github account. You will need a Github account if you want to contribute to the development of the app with your own code.
Next steps will assume you have a Github account and that you will get the code from your own fork.
git clone git@github.com:YOURGITHUBNAME/android.git
.cd android
.git checkout master remotes/origin/master
.git pull origin master
git remote add upstream git@github.com:owncloud/android.git
git pull upstream master
At this point you can continue using different tools to build the project. Section 2, 3, 4, 5 and 6 describe the existing alternatives.
Android Studio is currently the official Android IDE. Due to this, we recommend it as the IDE to use in your development environment. Follow the installation instructions here.
We recommend to use the last version available in the stable channel of Android Studio updates. See what update channel is your Android Studio checking for updates in the menu path 'Help'/'Check for Update...'/link 'Updates' in the dialog.
To set up the project in Android Studio follow the next steps:
setup_env.bat gradle
./setup_env.sh gradle
Gradle is the build system used by Android Studio to manage the building operations on Android apps. You do not need to install Gradle in your system, and Google recommends not to do it, but instead trusting on the Graddle wrapper included in the project.
setup_env.bat gradle
./setup_env.sh gradle
gradlew.bat clean build
./gradlew clean build
The first time the Gradle wrapper is called, the correct Gradle version will be downloaded automatically. An Internet connection is needed for it works.
The generated APK file is saved in android/build/outputs/apk as android-debug.apk
Eclipse is still an option to work with Android apps, although the ADT Plugin needed is not in active development anymore. Next steps have been tested in Eclipse Luna.
setup_env.bat ant
./setup_env.sh ant
Ant can be used to build the ownCloud for Android app in a terminal. Be sure that the PATH variable in your environment contains the full path to the 'bin/' subdirectory in your Ant installation. Define also an ANDROID_HOME variable in your environment with the full path to your Android SDK (see section 1). Then follow the next steps:
setup_env.bat ant
./setup_env.sh ant
ant clean
.ant debug
to generate a debuggable version of the ownCloud app.The resulting APKs will be saved in the 'bin/' subdirectory of the project.
** Currently these build instructions DO NOT WORK. There is no estimation time to fix it. Unless some volunteer contributor fixes this build option, and given that Maven is a minority option in Android environments, we will probably remove this option.
NOTE: You must have mvn (version >= 3.1.1) in your environment path. Current Android 'platforms-tools' need to be installed.
Download/install Android plugin for Maven, then build ownCloud with mvn:
Resolve necessary dependencies running:
cd ..
git clone https://github.com/mosabua/maven-android-sdk-deployer.git
cd maven-android-sdk-deployer
mvn -pl com.simpligility.android.sdk-deployer:android-22 -am install
mvn -pl com.simpligility.android.sdk-deployer:android-23 -am install
cd ../android/owncloud-android-library
mvn install
cd ..
Now you can create ownCloud APK using "mvn package" and find it as ownCloud.apk under the target