| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
The build system of Processing for Android is entirely based on Gradle (Ant support was removed because there are many critical steps, particularly related to dependency resolution, that cannot be easily implemented with Ant), and it includes Android Studio sample projects for developing and testing the core, VR, and any other Android-specific libraries. Eclipse projects for the Android mode and the SDK Updater tool are also provided.
The build system uses gradle to build processing core and mode, the VR and AR libraries, and the SDK Downloader tool, and to create the Android mode package ready to use.
The first step is to install the Android SDK. This can be done manually with the command line tools available at the bottom of this page under the "Command line tools only" section, where you can download the one corresponding to the Operating System you are using (Windows, Mac, or Linux). Unzip the zip file and move the contents of the resulting cmdline-tools folder into <path to SDK>/cmdline-tools/latest. For example (on Mac, and replacing with the correct version number and SDK folder):
unzip commandlinetools-mac-6858069_latest.zip mkdir ~/android-devel/SDK mkdir ~/android-devel/SDK/cmdline-tools mv cmdline-tools ~/android-devel/SDK/cmdline-tools/latest
One the command lines tools are placed in the SDK location, you can use the sdkmanager to download the necessary components of the SDK:
cd ~/android-devel/SDK/cmdline-tools/latest/bin ./sdkmanager "platform-tools" "platforms;android-33"
Then, create a local.properties file in the root folder of the repo with the following contents:
sdk.dir=<path to Android SDK>
In the case the previous examples, should be ~/android-devel/SDK/ but you can use any other location of your preference. If you are on Windows, use either double back slashes "\" as the file separator, or forward slashes "/" (Unix-style). Otherwise, the build process will fail. Alternatively, the build script will try to create this file automatically if the ANDROID_SDK environmental variable is defined in the system.
Once a valid local.properties is available, you can build the Android mode distribution by running:
cd processing gradle dist
Note that you first need to change into the processing subfolder, which contains all the source code files needed to build the mode. This also assumes you have Gradle version 7 (version 8 is not yet supported) available system-wide (binary releases can be downloaded from here), alternatively you can use the Gradle wrapper, which is included with the mode:
./gradlew dist
This will download all the required files to proceed with the build and distribution process.
If the build process of all modules concludes successfully, the AndroidMode.zip and the AndroidMode.txt files will be stored inside the processing/dist.
Clean all build files with:
gradle clean
or
./gradlew clean
Note that the ant build scripts are no longer provided to build the mode or core library.
Import the root folder into Android Studio, okay the Gradle Sync dialog that shows next, and wait for Android Studio to download all the dependencies. You should get a project space where you can run the provided sample apps (simple, wallpaper, vrcube, arscene, armarkers, watchface, and fast2d), add new apps, and modify and debug the core and vr libraries. The processing-core, processing-vr, and processing-ar Android library projects contain the full source of the libraries (which are the same used by the mode), so any changes to those files will affect the sample apps and the libraries bundled into the mode.
Note that the processing-vr will show errors in Android Studio, such as "Cannot resolve symbol GvrActivity". This is because processing-vr still depends on the deprecated Google VR SDK, which Google does no longer releases updates for. We include the Google VR packages inside the google-vr library provided alongside processing-vr, which only contains the AAR files from the last Google VR version (version 1.180). Since Android Studio cannot resolve the dependencies to the local AAR files, then it will show the errors, but the sample apps will run and are debuggeable. There is ongoing work to replace Google VR by Cardboard SDK, and a wrapper that resulted from a Google Summer of Code project in 2023 is a step towards that goal.
The Android mode is a Java project that can be developed from a Java IDE such as Eclipse or IntelliJ. The Eclipse project files are included, and the steps required to get the mode to run from Eclipse are as follows:
Since we only require Processing 4 as a dependency, perform a shallow clone of the Processing 4 repo and build it by running ant in the processing/build folder, as detailed in the build instructions for Processing 4:
git clone https://github.com/processing/processing4.git --depth 1
The Android mode source can be imported into a new IntelliJ project quite easily. As with Eclipse, we need to clone the Processing 4 repo first. Then:
These are some special tasks that only need to be run occasionally to update the Gradle wrapper included in the repo, or the Android permissions supported by the mode. Note that these tasks need to be invoked from inside the processing folder.
Run the following command to update the bundled Gradle wrapper:
gradle wrapper --gradle-version 7.4.2
(replacing 7.4.2 by the version of Gradle you want to update to). Then, you have to commit the new Gradle wrapper files to the repo. If no version is provided, then the gradle-wrapper version in the mode/versions.properties file is used instead.
Add --rerun-tasks to the command if the Gradle says that the task is up-to-date and refuses to update.
First make sure to install required dependencies to run this target with:
pip install -r mode/scripts/requirements.txt
and then:
gradle permissions
| Back | FazBrowse Home | New Git URL |