Hello. So, first of all, I’m running Processing 4.2 on Linux Mint (Ubuntu), using Processing’s Android mode. I want to export my project as an unsigned apk, since I don’t want it on the Google Play store or any third party app store, and just want to install it to my phone and maybe to a few friends’ phone if they need it.
So, from Processing, I selected File → Export Android Project. I then entered the android directory from the sketch folder via the terminal, and typed
./gradlew assembleDebug into the terminal. Then, I got the error message
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain
I looked this up, apparently the most likely cause for this is broken gradle files. So I tried regenerating them by running
gradle wrapper. And it gave me the error
FAILURE: Build failed with an exception. * Where: Build file '/home/chris/sketchbook/Calculator_5_App/android/app/build.gradle' line: 1 * What went wrong: A problem occurred evaluating project ':app'. > Failed to apply plugin [id 'com.android.internal.version-check'] > Minimum supported Gradle version is 7.2. Current version is 4.4.1. If using the gradle wrapper, try editing the distributionUrl in /home/chris/sketchbook/Calculator_5_App/android/gradle/wrapper/gradle-wrapper.properties to gradle-7.2-all.zip * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 6s
So, to make a long story short, this error message just means I’m expected to be using gradle version 7.2 or higher, even though I only have version 4.4.1. However, no matter how many times I use
sudo apt update or
sudo apt upgrade (which are commands that tell your system to update all packages that are installed, including gradle), gradle will never upgrade to a version past 4.4.1. So…that’s unfortunate. I read online that you can try manually downloading the newest version of gradle (which is currently 8.1.1) and then do some complicated root user magickery to use that to update it, but it seems very very difficult and I’m not even sure if that’d work because I’m not completely sure that it’s the gradle file that’s broken or something else.
Um, so yeah. I don’t really know what to do here. I’m not sure if it’s broken because it’s Processing for Android and that’s not as well maintained as the main java mode, or if it’s because I’m running it on Linux and the devs mainly focus on the Windows version (which is fair, I’m just glad they have a Linux version at all), or if it’s because I’m just stupid. It’s probably the last one. I couldn’t even figure out I was supposed to use gradlew until I asked ChatGPT for help, despite taking an entire semester of a course where we repeatedly used gradle over and over and over again.
Anyways, if you need any more information, please don’t hesitate to ask. Also, because I’m sure it’ll be helpful, the android folder where I’m typing these commands from contains the files:
and the folders:
The app folder contains files build.gradle and proguard-rules.pro, and folders libs and src.
The wrapper folder contains the single file gradle-wrapper.properties
app/libs contains the files ComplexNumbers.jar and processing-core.jar
app/src contains the folder main, and there’s a big long directory tree structure from there.
If you want more information on said big long directory tree structure, I can give you the output of
ls -R, which for those unfamiliar with Linux is a command which recursively shows all files, folders, and files and folders within those folders. Again, sorry if this is a bit of a more complicated issue than you’re used to. I’d post it to stack overflow, except the people on stack overflow are usually pretty mean to me and it gives me anxiety.