weliem / blessed-bluez

BLE library using Java and Bluez
MIT License
76 stars 21 forks source link

Build instructions, and Java dependencies #2

Closed d-f-clark closed 3 years ago

d-f-clark commented 3 years ago

This package looks great, just what I need. I'm building on a Raspberry Pi using the Buster version of Raspbian, with OpenJD K 11. Could you provide guidance on any Java dependencies in the project, and some build instructions? Thanks

weliem commented 3 years ago

Hi, I just updated the readme with some more information.

Let me know if this is sufficient!

d-f-clark commented 3 years ago

Thank you, and thanks for the quick response.

It looks like the only difference for the build.gradle file is the addition of the jitpack line, is that correct? I don’t typically use gradle so I’m stumbling along trying to get the various components needed onto my Raspberry Pi, and get this library built.

I made the change in the build.gradle file, then started gradle and ran the build command (“gradle build”). That produced a bunch of errors, as shown in the attached file. Hopefully you have some insight into what’s happening.

Also, it seems that there is a Java dependency in the build.gradle file for Java 1.8 - I’ve got OpenJDK 11, which reports it’s version as 11.0.6.

Thanks for your help.

On May 29, 2021, at 14:05, Martijn van Welie @.***> wrote:

Hi, I just updated the readme with some more information.

Let me know if this is sufficient!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/weliem/blessed-bluez/issues/2#issuecomment-850874673, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF7NUSDXEL26LWYHT2SN4F3TQEUIHANCNFSM45YK5Y4Q.

d-f-clark commented 3 years ago

I’ve just tried again with what I think are the proper changes to the build.gradle file, and again got a bunch of errors. Files attached.

On May 29, 2021, at 15:09, Donald F Clark Sr @.***> wrote:

Thank you, and thanks for the quick response.

It looks like the only difference for the build.gradle file is the addition of the jitpack line, is that correct? I don’t typically use gradle so I’m stumbling along trying to get the various components needed onto my Raspberry Pi, and get this library built.

I made the change in the build.gradle file, then started gradle and ran the build command (“gradle build”). That produced a bunch of errors, as shown in the attached file. Hopefully you have some insight into what’s happening.

Also, it seems that there is a Java dependency in the build.gradle file for Java 1.8 - I’ve got OpenJDK 11, which reports it’s version as 11.0.6.

Thanks for your help.

> On May 29, 2021, at 14:05, Martijn van Welie ***@***.*** ***@***.***>> wrote: > > > Hi, I just updated the readme with some more information. > > Let me know if this is sufficient! > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub , or unsubscribe . >
weliem commented 3 years ago

I can't see your attachments. Please paste some relevant lines as text in a comment.

OpenJDK 11 shouldnt be a problem. I only set the compatibility level to a minimum of 8....

weliem commented 3 years ago

If you simply clone the entire project and run 'gradle build', it should work on a Pi4

d-f-clark commented 3 years ago

Running on a RPi3, but I imagine that should be good enough.

I did clone the repository onto the RPi, then ran 'gradle build', produced a bunch of errors (see below). The build.gradle from the clone doesn't match the change in the README.md that you made today.

~/RelatedTools/theclone $ gradle build

FAILURE: Build failed with an exception.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 7s

gradle_build3.log

weliem commented 3 years ago

Looks like gradle cannot find the OpenJDK cacerts file.

Sounds like you're have this issue: https://stackoverflow.com/questions/31132751/gradle-can-not-find-cacerts-file-wrong-direcrory-looked-up

weliem commented 3 years ago

Any update?

d-f-clark commented 3 years ago

Given up, no time to solve gradle issues apparently caused by snap.

On Jun 3, 2021, at 13:19, Martijn van Welie @.***> wrote:

Any update?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/weliem/blessed-bluez/issues/2#issuecomment-854042953, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF7NUSAUEELP66BOLX3FP4LTQ62RBANCNFSM45YK5Y4Q.

d-f-clark commented 3 years ago

Thanks for your attempts to help.

On Jun 3, 2021, at 13:19, Martijn van Welie @.***> wrote:

Any update?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/weliem/blessed-bluez/issues/2#issuecomment-854042953, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF7NUSAUEELP66BOLX3FP4LTQ62RBANCNFSM45YK5Y4Q.

weliem commented 3 years ago

Sorry to hear, but no worries!

d-f-clark commented 3 years ago

I’m back to giving this a try. Re-installed snap and gradle, and cloned blessed-blues again, ran gradle build. Got a lot farther this time, but here’s the build output. Perhaps you would have a suggestion:

Starting a Gradle Daemon (subsequent builds will be faster)

Task :blessed:compileJava Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.

Task :blessed:processResources NO-SOURCE Task :blessed:classes Task :blessed:jar Task :compileJava Task :processResources Task :classes Task :jar FAILED

FAILURE: Build failed with an exception.

On Jun 3, 2021, at 14:36, Donald F Clark Sr @.***> wrote:

Thanks for your attempts to help.

On Jun 3, 2021, at 13:19, Martijn van Welie @. @.>> wrote:

Any update?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/weliem/blessed-bluez/issues/2#issuecomment-854042953, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF7NUSAUEELP66BOLX3FP4LTQ62RBANCNFSM45YK5Y4Q.

weliem commented 3 years ago

I see that the project doesn't build when using gradle 7. I have pushed a fixed.

Please try again

d-f-clark commented 3 years ago

That worked, thanks! The gradle build did produce some errors, in the test phase. Log file is attached. build_log.txt

weliem commented 3 years ago

I see the Pi3 is a bit slower than my tests expect. I updated the tests to be more lenient.

Please try again

d-f-clark commented 3 years ago

I'll try the build again, but since the jar file built successfully I thought I'd try to add the BluetoothHandler into a test app that I have. Instantiation of BluetoothHandler class fails on a class-not-found exception. Seems this library depends on org.freedesktop? What components?

13:32:44.837 [main] INFO testapp.BLEpoller.AdvertisementPoller - initializing BluetoothCentral Exception in thread "main" java.lang.NoClassDefFoundError: org/freedesktop/dbus/exceptions/DBusException at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:468) at java.net.URLClassLoader.access$100(URLClassLoader.java:74) at java.net.URLClassLoader$1.run(URLClassLoader.java:369) at java.net.URLClassLoader$1.run(URLClassLoader.java:363) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:362) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at approach.BLEpoller.BluetoothHandler.(BluetoothHandler.java:258) at approach.Approach.main(Approach.java:71) Caused by: java.lang.ClassNotFoundException: org.freedesktop.dbus.exceptions.DBusException at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 14 more

weliem commented 3 years ago

hmmm, that is odd. Looks like it can't find class files that should be there.

Are you able to run the demo app? After doing a 'gradle build' you can start it using: java -jar build/libs/blessed-test-0.2-App.jar

How did you include Blessed in your project? Using gradle?