processing-android icon indicating copy to clipboard operation
processing-android copied to clipboard

Update Gradle tooling to latest version

Open p4puniya opened this issue 2 years ago • 12 comments

The Gradle dependencies of version: 7.2 (gradle-tooling) are not supported by JAVA-17. (as given in: https://docs.gradle.org/current/userguide/compatibility.html)

JAVA-17 supports gradle versions 7.3 and higher. Due to this issue, the build is failing. Could you help me in rectifying this issue? @codeanticode

p4puniya avatar Mar 18 '23 17:03 p4puniya

Thanks for flagging this. I have not experienced any issues with the build process (using Java 17 from Adoptium on macOS). What's the exact error message you are getting?

@rupeshkumar22 do you have any suggestions/comments about this issue?

codeanticode avatar Mar 20 '23 03:03 codeanticode

When I build the PDE for Android and run it on an Emulator/Device, it shows this error message: Exception in thread "Thread-11" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory at org.gradle.internal.concurrent.CompositeStoppable.(CompositeStoppable.java:37) at org.gradle.internal.service.DefaultServiceRegistry$OwnServices.(DefaultServiceRegistry.java:389) at org.gradle.internal.service.DefaultServiceRegistry.(DefaultServiceRegistry.java:105) at org.gradle.internal.service.DefaultServiceRegistry.(DefaultServiceRegistry.java:92) at org.gradle.tooling.internal.consumer.ConnectorServices$ConnectorServiceRegistry.(ConnectorServices.java:60) at org.gradle.tooling.internal.consumer.ConnectorServices$ConnectorServiceRegistry.(ConnectorServices.java:60) at org.gradle.tooling.internal.consumer.ConnectorServices.(ConnectorServices.java:37) at org.gradle.tooling.GradleConnector.newConnector(GradleConnector.java:86) at processing.mode.android.AndroidBuild.gradleBuildPackage(AndroidBuild.java:316) at processing.mode.android.AndroidBuild.build(AndroidBuild.java:225) at processing.mode.android.AndroidMode.handleRunEmulator(AndroidMode.java:246) at processing.mode.android.AndroidEditor$16.run(AndroidEditor.java:399) Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)

p4puniya avatar Mar 21 '23 18:03 p4puniya

Before this also, I had to import multiple dependencies for building the project, including Apache logger, common jar, Flatlaf, lsp4j, repository-30.3.0, sdklib, slf4j and tooling. It appears that all the project is not downloading all the dependencies when build. Maybe the gradle files need to be updated.

p4puniya avatar Mar 21 '23 18:03 p4puniya

As for this slf4j logger, even importing the jar file doesn't seem to help. What I found was that tooling was not supported with the gradle version.

p4puniya avatar Mar 21 '23 18:03 p4puniya

If possible, I would like to work on this issue, please guide me in the right direction.

p4puniya avatar Mar 21 '23 18:03 p4puniya

Thanks for flagging this. I have not experienced any issues with the build process (using Java 17 from Adoptium on macOS). What's the exact error message you are getting?

@rupeshkumar22 do you have any suggestions/comments about this issue?

Hi @codeanticode , gradle issue is real, for @p4puniya I tried setting up pde and mode for him over the meet but gradle version issue persists there.

According to my understanding what happens with gradle is when you have more than one version of gradle in your system, cache corruption due to wrong version of gradle use instead of the required creates the issue many times.

And while building for processing-mode with Java 17 , i think we need to upgrade to the gradle version.

Apart from gradle issue, dependencies issue is also there, idk why but this happened during my time as well.

So exactly what happens you can see the dependencies in the gradle / module folder but when you try to build the code it says some files are missing or class not found error for the some dependencies this varies system to system. To fix this i got the temporary solution - just list all the dependencies creating issue -> download them with correct version in your local from maven , etc -> go to project settings -> add the local downloaded dependencies to the modules where they are being used.

This helped me to solve the issue long back. Though this is a temporary solution.

What I feel is we need to change the mechanism how dependencies are being managed in our codebase.

I am open for discussion.

@p4puniya will try to solve your issue over a meet today (most probably).

Thanks !

ranaaditya avatar Mar 22 '23 07:03 ranaaditya

@p4puniya @ranaaditya so this error happens not when building the mode using Gradle, but when you try to run a sketch from the PDE, is that correct?

codeanticode avatar Mar 22 '23 17:03 codeanticode

It happens when building mode with Gradle. But that can be temporarily fixed by importing the dependencies that give the error and thus, we can build our project. But when you run any code in the pde, the dependencies give the error again, just that they can't be externally imported this time.

p4puniya avatar Mar 22 '23 22:03 p4puniya

If this issue is affects running code from the PDE it should be impacting many users, so far does not seem to be the case. So it must be happening only under certain circumstances, Aditya said something about having several versions of Gradle installed in the system? I have not experienced it myself...

My suggestion would be to update all the various gradle versions in use by the Android mode. The thing is that there is no single gradle tool/plugin/dependency, so far I think we have the following:

I do not know if I missing anything but my recommendation would be to upload all of these version so the latest in each category and see what happens. Some things might break and require updating the build scripts or the code of the mode itself :-)

codeanticode avatar Mar 23 '23 12:03 codeanticode

If this issue is affects running code from the PDE it should be impacting many users, so far does not seem to be the case. So it must be happening only under certain circumstances, Aditya said something about having several versions of Gradle installed in the system? I have not experienced it myself...

My suggestion would be to update all the various gradle versions in use by the Android mode. The thing is that there is no single gradle tool/plugin/dependency, so far I think we have the following:

I do not know if I missing anything but my recommendation would be to upload all of these version so the latest in each category and see what happens. Some things might break and require updating the build scripts or the code of the mode itself :-)

Hi @codeanticode , yes I also think that upgrading the Gradle version to 7.3+ would solve the issue.

Please take a look at Gradle Matrix Compatibility

Thanks, Aditya Rana

ranaaditya avatar Jul 16 '23 09:07 ranaaditya

If this issue is affects running code from the PDE it should be impacting many users, so far does not seem to be the case. So it must be happening only under certain circumstances, Aditya said something about having several versions of Gradle installed in the system? I have not experienced it myself... My suggestion would be to update all the various gradle versions in use by the Android mode. The thing is that there is no single gradle tool/plugin/dependency, so far I think we have the following:

I do not know if I missing anything but my recommendation would be to upload all of these version so the latest in each category and see what happens. Some things might break and require updating the build scripts or the code of the mode itself :-)

Hi @codeanticode , yes I also think that upgrading the Gradle version to 7.3+ would solve the issue.

Please take a look at Gradle Matrix Compatibility

Thanks, Aditya Rana

Hi @p4puniya , i think you can check simply by upgrading the gradle tooling api version.

Let me know if you face any issue in this.

For referrence similar issue

Thanks, rana

ranaaditya avatar Jul 16 '23 09:07 ranaaditya

So far, I don't see any errors in building the mode or running sketches from the PDE or Android Studio related to the current version of the tooling. However, we should update it to latest versions at some point. Updating to Gradle 8 may require some changes in the build files:

https://docs.gradle.org/current/userguide/upgrading_version_7.html

codeanticode avatar Oct 30 '23 00:10 codeanticode