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

getBondedDevices throws [Failed resolution of: Landroidx/core/content/ContextCompat]; #52

Closed
kula124 opened this issue Aug 8, 2019 · 5 comments
Assignees
Labels
Type: Bug Something isn't working

Comments

@kula124
Copy link

kula124 commented Aug 8, 2019

Hello!
The getBondedDevices call never finishes, it crashes the app.
I'm trying to get now connected device's address. I've gone through the lib code and failed to find this method anywhere so my idea was to get all the paired devices and find the one with BluetoothBondState.bound. IDK if this method gets paired devices or connected devices, this is what I'm testing / trying to figure out.
However... the initial call fails. This is me testing the method:
https://pastebin.com/5cdX052g

Again, I know. Async in build sux. I just wanna see the output.
This is the debug console output doe:
https://pastebin.com/tsvy0nEh

Manifest:
https://pastebin.com/PRG6vcDF

Tried flutter clean. Breakpoint just at the call says it has to be that call that breaks the app. Commenting it out works...
2 hours of googlng didn't help.
I'm running linux (obvious from debug message), live device Samsung J7, Android 9.1.
Any ideas?

EDIT: I don't know how Github "code" works but I don't like it. Moved it to mpastebin.

@AgainPsychoX AgainPsychoX self-assigned this Aug 8, 2019
@AgainPsychoX AgainPsychoX added the Type: Bug Something isn't working label Aug 8, 2019
@AgainPsychoX
Copy link
Collaborator

Hello,

It looks like the main issue is unavailable resolution of AndroidX.

Which version of the plugin are you using? If still 0.2, please update to 0.2.1 - there was a some fix related to AndroidX afik.

@kula124
Copy link
Author

kula124 commented Aug 9, 2019

Thank you for quick response.
I am using ´0.2.1´. Not using AndroidX. I opened the project with Android Studio to move it to AndroidX via the refactor menu. It gave me "Not using" message and the directory was unchanged.
Is it possible I'm using it the wrong way?
I just don't see it atm might be smtg trivial.
Ideas?
The package file is bellow:

version: 1.0.0+1

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2
  flutter_bluetooth_serial: ^0.2.1

dev_dependencies:
  flutter_test:
    sdk: flutter 

EDIT:
In the log it mentions the permission method. Am I missing anything in the manifest?
I'll go ahead and clone one of your examples to make sure I'm not doing anything wrong code-wise.
If it fails again it has to be the lib and/or it is device specific.
Gonna let you know.

EDIT2: This is a runtime error, not compile time. Most error related to AndroidX are compile-time. Code compiles fine. Commenting out the method call (getBoundedDevices) fixes the crash so it's smtg about that method....

@kula124
Copy link
Author

kula124 commented Aug 9, 2019

Adding

android.useAndroidX=true
android.enableJetifier=true

to gradle.properties fixes it 🤦‍♂️

Maybe we could add a note to Readme? It was a solution to similar compile time issue as well.
Anyways I'll close it now

@kula124 kula124 closed this as completed Aug 9, 2019
@AgainPsychoX
Copy link
Collaborator

AgainPsychoX commented Aug 9, 2019

I was just about to ask about it :D haha Just seconds to click "comment" lol

Anyway, the v0.2.1 was adding these lines (at least at the plugin gradle.properties), so then you should also have these defined in your application file (I think example app also do).

@AgainPsychoX AgainPsychoX pinned this issue Aug 19, 2019
@kamilk91
Copy link

@PsychoXIVI the same problem with v0.2.2, and adding

android.useAndroidX=true
android.enableJetifier=true

helped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants