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

java.lang.NullPointerException #49

Closed
iblinov65apps opened this issue Dec 16, 2019 · 4 comments
Closed

java.lang.NullPointerException #49

iblinov65apps opened this issue Dec 16, 2019 · 4 comments
Assignees
Labels
Milestone

Comments

@iblinov65apps
Copy link

iblinov65apps commented Dec 16, 2019

It's some problems with private static String getAndroidId(Context context) on some Oreo and Pie devices: ONEPLUS A6010 (9), Pixel 2 XL (10), Mi A1 (9) (from Crashlytics)

java.lang.NullPointerException: provided string must not be null
       at java.util.Objects.requireNonNull + 228(Objects.java:228)
       at at.favre.lib.bytes.Bytes.from + 502(Bytes.java:502)
       at at.favre.lib.bytes.Bytes.from + 480(Bytes.java:480)
       at at.favre.lib.armadillo.EncryptionFingerprintFactory.create + 49(EncryptionFingerprintFactory.java:49)
       at at.favre.lib.armadillo.Armadillo$Builder.encryptionFingerprint + 159(Armadillo.java:159)
       at at.favre.lib.armadillo.Armadillo$Builder.encryptionFingerprint + 111(Armadillo.java:111)

Please, fix it, if possible.

@patrickfav patrickfav added the bug label Dec 17, 2019
@patrickfav
Copy link
Owner

Hi,

It seems getAndroidId() returns null on these devices - I am not aware that this is an expected behaviour (or have expirenced this myself, although I'm not actively working on Oreo/Pie devices). I would welcome suggestions why this might be null (lifecycle issue?). Other than that your only course of action is to use a custom EncryptionFingerprint with encryptionFingerprint(EncryptionFingerprint fingerprint) which ommits the android id.

@nicolasSchirmer
Copy link

nicolasSchirmer commented Apr 6, 2020

Hey Patrick, did you looked into this issue?

Here is a clue for it :)
https://android-developers.googleblog.com/2017/04/changes-to-device-identifiers-in.html

@patrickfav
Copy link
Owner

Hi @nicolasSchirmer

Thanks for the link! Im totally aware of the new behavior. The problem is, resturning null as ANDROID_ID is not a defined behavior and very probably a Device bug :/

@patrickfav
Copy link
Owner

patrickfav commented Apr 9, 2020

I've implemented a fallback ANDROID_ID if the one provided by the OS is null. Be aware, that if that behaviour is not deterministic, this may compromise the ability to encrypt/decrypt in the future. If that is the case, your only option is to re-implement EncryptionFingerprint and omit this property.

See: https://github.com/patrickfav/armadillo/releases/tag/v0.10.0

@patrickfav patrickfav self-assigned this Apr 9, 2020
@patrickfav patrickfav added this to the v0.10.0 milestone Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants