-
Notifications
You must be signed in to change notification settings - Fork 366
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
People.set throwing UnsupportedOperationException #803
Comments
I also faces same error when setting data on people like below
I get error as below
It is crashing only in release build in debug build working fine. I have already used pro guard for the Mix Panel SDK. Please let me know if you find any solution for the same. Thank you UPDATE I downgraded SDK version to 6.5.1 and it's working fine but events are not being logged in mixpanel dashboard |
Indeed I forgot to mention it seems to be working fine on debug builds. @chichi289 FYI I used the following bypass, that seems to work: override suspend fun setPeople(properties: Map<String, Any?>) {
with(mixpanel.people) {
properties.keys.forEach { unset(it) }
setOnceMap(properties.filterValues { it != null })
}
}
|
@badoualy Thanks for the suggestions I imported mix panel library as a module in project and checked the code which causes exception.
Here mDeviceInfo is passed in JSONObject constructure which causes crash as it is constructed as unmodified map as below
So my guess is somewhere it is being modified. If we remove mDeviceInfo from JSONObject constructor then code is compiled and worked fine in release app. @badoualy setOnceMap is working as it is not using mDeviceInfo internally @zihejia Please look into this and provide solutions for the same Thank you |
Ah indeed, it might be linked to a bad dependency. When checking the code, I had another version of
But I also have this version in my classpath:
Not sure which one mixpanel is supposed to use. Maybe it's another dependency in our project that's overriding the dependency that mixpanel SDK is using? Edit: ok so in my case, it looks like the
which is the version using the map passed to the constructor as is without making a copy. So the issue isn't actually with mixpanel SDK, but maybe a disclaimer about this could be nice in the setup doc |
Thanks guys for bringing this up and finding a solution. I've added this issue to the FAQ section of our documentation. |
An exception is thrown when calling set on people
SDK version: 6.5.2
In the mean time I tried to bypass by using
unset
on all properties, thensetOnceMap
The text was updated successfully, but these errors were encountered: