pablojimenezmateo / GodotAndroidBluetoothPlugin

Android Studio project for GodotAndroidBluetooth
35 stars 5 forks source link

Engine.has_singleton("GodotBluetooth344") returns false #2

Closed IanBUK closed 1 year ago

IanBUK commented 1 year ago

When I open the demo project, set all Android permissions to true, set my debug keystore settings and then export to my tablet, I find that:

Engine.has_singleton("GodotBluetooth344"):

returns false.

The app opens and shows:

"Loc. permissions: On"
"Loc.status: On"
"Bluetooth status: On"
"Connected" No"

I'm using Godot 3.5.2, on an M1 Mac, and an Android A8 tablet. The 'plugins' tab of the project settings popup is empty.

Can you advise please?

Thanks.

pablojimenezmateo commented 1 year ago

hmm, that is very strange. I will have to revisit this project and update it for 3.5.x and 4.x.

In the meantime, you could try with the debug release of the plugin, from the plugin project download GodotBluetooth344-debug.aar, place it in GodotBluetooth344/libs and rename it to godot-lib.3.4.4.stable.release.aar (you either need to rename it to that or search and replace all matches of the old name).

This may give you some extra information, let me know what you find.

peakpwr commented 1 year ago

What changes need to be made to port this module to godot 4 ?

Cheers

IanBUK commented 1 year ago

Will do - and thanks for the quick response. It’s likely to be a few days before I get chance to try.On 30 May 2023, at 07:15, Pablo Jiménez Mateo @.***> wrote: hmm, that is very strange. I will have to revisit this project and update it for 3.5.x and 4.x. In the meantime, you could try with the debug release of the plugin, from the plugin project download GodotBluetooth344-debug.aar, place it in GodotBluetooth344/libsand rename it togodot-lib.3.4.4.stable.release.aar` (you either need to rename it to that or search and replace all matches of the old name). This may give you some extra information, let me know what you find.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

IanBUK commented 1 year ago

Thanks for your help.

I tried what you suggested and got a step further, there was a permissions problem and I had to enable location permissions for the app - but from Android’s permissions on the tablet, not the permissions in the Export window within Godot.

Now, it gets to the stage of being able to press ’Scan’. Then I get a hard crash, no logging that I can see.

I copied the .aar file and renamed it as you suggested, putting it in the ‘libs’ folder at the top level of the app source. However, under the ‘Android’ folder, I’ve still got a ‘plugins’ folder with the original GodotBluetooth344-debug.aar file, as shown in the screenshot below:

If I remove this plugins folder, I get an error shown in the debugger when I run the app: 

The errors tab shows: 

The code at line 133, shown in the ‘Debugger’ error above, is: 

So, inside the call to bluetoothStatus.

I’ve uploaded my current version of your demo - showing exactly where I've got the libraries etc, it's at: https://drive.google.com/drive/folders/1vf_VvyVQGg0ohhNEIUJeu3CAd22mBx-4?usp=sharing Please, can you advise what I should try next?

Thanks,

Ian Brown

On 30 May 2023, at 14:47, @. @.> wrote:

Will do - and thanks for the quick response. It’s likely to be a few days before I get chance to try.

On 30 May 2023, at 07:15, Pablo Jiménez Mateo @.***> wrote:



hmm, that is very strange. I will have to revisit this project and update it for 3.5.x and 4.x.

In the meantime, you could try with the debug release of the plugin, from the plugin project download GodotBluetooth344-debug.aar, place it in GodotBluetooth344/libsand rename it togodot-lib.3.4.4.stable.release.aar` (you either need to rename it to that or search and replace all matches of the old name).

This may give you some extra information, let me know what you find.

— Reply to this email directly, view it on GitHub https://github.com/pablojimenezmateo/GodotAndroidBluetoothPlugin/issues/2#issuecomment-1567814893, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASVEMOTFCUI277MHNM5H5L3XIWF67ANCNFSM6AAAAAAYS7WIH4. You are receiving this because you authored the thread.

IanBUK commented 1 year ago

Hi, I've no idea where the images went, they were there when I posted!

Anyway, I started again. I created a new Godot app, having taken a clean download of the demo.

Changes I made: 1) Set 'Use Custom Build' to true 2) Set the Min/Target SDK to 32 3) Added my Debug Keystore settings.

When run, all appears fine until I press 'scan'. Then the app closes. The crash occurs on the line below: GodotBluetooth344.scan()

I re-read your suggestion:

In the meantime, you could try with the debug release of the plugin, from the plugin project download GodotBluetooth344-debug.aar, place it in GodotBluetooth344/libs and rename it to godot-lib.3.4.4.stable.release.aar (you either need to rename it to that or search and replace all matches of the old name).

But got confused. I tried: 1) Taking the godot-lib.3.4.4.stable.release.aar file from the plugin project download and putting it in a new folder from the Godot project root - GodotBluetooth344/libs, renamed as GodotBluetooth344-debug.aar. Exporting and running that made no difference.

2) Taking the godot-lib.3.4.4.stable.release.aar file from the plugin project download and putting it in the android/plugins folder underneath the project root, renamed as GodotBluetooth344-debug.aar. That failed to build.

3) Taking the godot-lib.3.4.4.stable.release.aar file from the plugin project download and putting it in the android/plugins folder underneath the project root, removing the GodotBluetooth344-debug.aaralready there. That'd build. but failed with 'Invalid call. Nonexistent function 'bluetoothStatus' in base 'Nil'.

4) Following the link in your advice to the demo project, rather than the plug in project, and using the .aar file from that. Exporting and running that made no difference.

So, I'm really not sure what to do next? Those last instructions confused me, as they seemed to be based on the build for an Android app, not a Godot one. Can you confirm please?

Thanks for your help,

Ian.

IanBUK commented 1 year ago

This is all working now, I've submitted a PR for some updates I've made to the library.

pablojimenezmateo commented 1 year ago

Thank you so much! I will review and merge ASAP!