Closed jamiesanson closed 1 month ago
PR open to resolve this here: https://github.com/optimizely/android-sdk/pull/490
@jamiesanson Thanks for reporting and submitting a PR for the issue! We'll take a look.
@jamiesanson really appreciated your support. Could you please sign in the CLA, so that we can approve your PR.
Sure thing, signed!
@jamiesanson the fix has been released with version 4.0.4. Thanks for your efforts.
Is there an existing issue for this?
SDK Version
4.0.1
Current Behavior
When using the Optimizely SDK in release mode (minified by R8 in full mode), and deserializing a config object which contains JSON arrays, the SDK throws an exception:
Expected Behavior
The SDK does not throw an exception.
Steps To Reproduce
Link
No response
Logs
No response
Severity
Affecting users
Workaround/Solution
We've done some digging, and realised the issue is arises due to a missing R8 rule.
Optimizely includes Gson as a runtime dependency for the purpose of deserializing Config. R8 keeps the Gson library, but minifies class names. Optimizely only chooses to use Gson if it can find the
com.google.gson.Gson
class, which is no longer called this. This causes the Optimizely Java SDK to fall back toorg.json
. Android includes a reimplementation of this dependency which is missing functionality the Java SDK relies on (having anIterable
implementation), causing the Optimizely SDK to crash at runtime.The fix is to keep the name of the
Gson
class, such that the Java SDK is able to select the Gson-based config parser:Recent Change
No response
Conflicts
No response