1

So, I'm using the Processing IDE to develop an android app. I'm not publishing it to the play store, I just plan on installing it onto my phone and possibly a friend's phone if they ask for it. I expect the end result to be some file called app-debug.apk.

I’m running Processing 4.2 on Linux Mint (Ubuntu), using Processing’s Android mode. I have tested this app by plugging my phone into my computer and using USB debugging to run the app on my phone. It works. So I'm pretty sure that faulty code isn't the culprit, but I could be wrong.

So, from Processing, I selected File → Export Android Project. This created a directory in my sketch folder called "android", which I then entered 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'm not super great with gradle, so I looked this up, apparently the most likely cause for this is broken gradle files and gradle wrapper files within this directory. So I tried regenerating them by running gradle wrapper from the same directory. 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 (at least I'm pretty sure that's what it means). 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 difficult and I’m not even sure if that’d work because I’m not completely sure if 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.

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:

  • build.gradle
  • gradle.properties
  • gradlew
  • gradlew.bat
  • local.properties
  • settings.gradle

and the folders:

  • app
  • wrapper

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. I'd also be more than happy to provide any other information you may need. Really, any help is appreciated.

Thank you!

Math Machine
  • 123
  • 6

1 Answers1

0

Have you upgraded gradle with the gradle wrapper as suggested by the error message?

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

In the wrapper.properties file, there should be a value for distributionUrl. Change the last part of the URL gradle-7.2-all.zip:

distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
Alexander Hoffmann
  • 5,104
  • 3
  • 17
  • 23
  • I made the recommended change. I went into wrapper/gradle-wrapper.properties and edited it from "distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip" to "distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip", saved it, then again entered ./gradlew assembleDebug. It still fails, however, giving the first error message about GradleWrapperMain. Also, side question, should I edit my original post to reflect that this right here has been attempted? Thank you – Math Machine Jun 22 '23 at 21:20