Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Gradle tooling to latest version #732

Open
p4puniya opened this issue Mar 18, 2023 · 12 comments
Open

Update Gradle tooling to latest version #732

p4puniya opened this issue Mar 18, 2023 · 12 comments

Comments

@p4puniya
Copy link

p4puniya commented Mar 18, 2023

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 p4puniya changed the title Gradle 1.7.2 not supported by JAVA-17 Gradle 7.2 not supported by JAVA-17 Mar 18, 2023
@p4puniya p4puniya changed the title Gradle 7.2 not supported by JAVA-17 Gradle Tooling 7.2 not supported by JAVA-17 Mar 18, 2023
@codeanticode
Copy link
Member

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?

@p4puniya
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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

@ranaaditya
Copy link
Member

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 !

@codeanticode codeanticode added this to the 4.5.1 bugfixes milestone Mar 22, 2023
@codeanticode
Copy link
Member

@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?

@p4puniya
Copy link
Author

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.

@codeanticode
Copy link
Member

codeanticode commented Mar 23, 2023

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 :-)

@ranaaditya
Copy link
Member

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
Copy link
Member

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

@codeanticode
Copy link
Member

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 codeanticode changed the title Gradle Tooling 7.2 not supported by JAVA-17 Update Gradle tooling to latest version Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants