amplitude / Amplitude-Kotlin

Amplitude Kotlin SDK
MIT License
27 stars 10 forks source link

ProGuard R8 warning for Android #194

Open diegocarloslima opened 2 months ago

diegocarloslima commented 2 months ago

Expected Behavior

The build should have performed without any ProGuard related warnings.

Current Behavior

I'm getting the following warning message from R8:

Missing method java.util.Set org.json.JSONObject.keySet() (referenced from: void com.amplitude.core.utilities.TooManyRequestsResponse.<init>(org.json.JSONObject))

I believe that this issue might even result in a runtime crash, depending on which response we get from the server.

Possible Solution

The problem seems to lie in the Android framework JSONObject class, which doesn't contain the method keySet(). Probably there's a version difference between the framework and the one used by Amplitude project.

One possible solution would be to replace .keySet() calls in Response.kt by .keys().asSequence().toSet()

Environment