seontechnologies / seon-android-sdk-public

11 stars 3 forks source link

`getFingerprintBase64` throws `JSONException` in minified build #38

Closed tommyjackson closed 2 months ago

tommyjackson commented 3 months ago

When enabling R8 code obfuscation via setting isMinifyEnabled = true for our release build, we get an error when calling getBaseFingerprint64. The retraced stack trace looks like:

org.json.JSONException: JSONObject["device_id"] is not a string (class lg.d : null).
        at org.json.JSONException.<init>(JSONException.java:36)
        at org.json.JSONObject.wrongValueFormatException(JSONObject.java:2910)
        at org.json.JSONObject.getString(JSONObject.java:859)
    at io.seon.androidsdk.service.SeonFingerprint.e(SourceFile)
    at io.seon.androidsdk.service.SeonFingerprint.a(SourceFile:5)
    at io.seon.androidsdk.service.SeonFingerprint.a(SourceFile:6)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
    at java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
    at java.lang.Thread.run(Thread.java:1012)

where lg.d maps to com.google.firebase.heartbeatinfo.HeartBeatConsumerComponent.

If I add a keep rule for that package (-keep class com.google.firebase.heartbeatinfo.** { *; }), I run into the same error with com.google.android.material.shape.EdgeTreatment, and then if I add a keep rule for that package a different one takes its place, so on and so forth. As far back as I've gone adding keep rules the problems all seem to be com.google.* classes, but adding a keep rule for all of that (-keep class com.google.** { *; }) results in the following, and org.json.c doesn't seem to map to anything.

org.json.b: JSONObject["device_id"] is not a string (class org.json.c : null).
    at org.json.d.g(Unknown Source:101)
    at org.json.d.getString(Unknown Source:14)
    at io.seon.androidsdk.service.SeonUtil.f(SourceFile:1045)
    at io.seon.androidsdk.service.SeonProbe.run(SourceFile:17)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
    at java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
    at java.lang.Thread.run(Thread.java:1012)

We are on version 6.4.1 of the SDK, the latest available at this time.

alexatmythical commented 2 months ago

@tommyjackson did U find any workaround? We've just faced the same issue

tommyjackson commented 2 months ago

@tommyjackson did U find any workaround? We've just faced the same issue

Nope. I assume this is something we'll have to wait on Seon to address.

robertorsulics-seon commented 2 months ago

Hey folks, thank you for your patience! We've found the root cause and we'll address this in the next release!

robertorsulics-seon commented 2 months ago

Hey @tommyjackson, @alexatmythical ! We've just released version 6.4.2 which includes the fix for this issue! Could you please check it out and let us know if it solves the errors for you as well?

alexatmythical commented 2 months ago

What a good news, thanks! We'll check soon and then come up with feedback

alexatmythical commented 2 months ago

All good 👌

robertorsulics-seon commented 2 months ago

Awesome, thanks for getting back to us! I'll close this issue for now