react-native-spotify-remote
react-native-spotify-remote copied to clipboard
Android Build Error: incompatible types: ReadableMap cannot be converted to WritableMap
Building Android fails with errors
warning: unknown enum constant Include.NON_NULL
reason: class file for com.fasterxml.jackson.annotation.JsonInclude$Include not found
/node_modules/react-native-spotify-remote/android/src/main/java/com/reactlibrary/Convert.java:42: error: incompatible types: ReadableMap cannot be converted to WritableMap
array.pushMap(Convert.toMap(item));
^
/node_modules/react-native-spotify-remote/android/src/main/java/com/reactlibrary/Convert.java:105: error: incompatible types: ReadableMap cannot be converted to WritableMap
map.putMap("artist", Convert.toMap(track.artist));
^
/node_modules/react-native-spotify-remote/android/src/main/java/com/reactlibrary/Convert.java:106: error: incompatible types: ReadableMap cannot be converted to WritableMap
map.putMap("album", Convert.toMap(track.album));
^
/node_modules/react-native-spotify-remote/android/src/main/java/com/reactlibrary/Convert.java:138: error: incompatible types: ReadableMap cannot be converted to WritableMap
map.putMap("playbackOptions", Convert.toMap(playerState.playbackOptions));
^
/node_modules/react-native-spotify-remote/android/src/main/java/com/reactlibrary/Convert.java:139: error: incompatible types: ReadableMap cannot be converted to WritableMap
map.putMap("playbackRestrictions", Convert.toMap(playerState.playbackRestrictions));
^
/node_modules/react-native-spotify-remote/android/src/main/java/com/reactlibrary/Convert.java:140: error: incompatible types: ReadableMap cannot be converted to WritableMap
map.putMap("track", Convert.toMap(playerState.track));
This seems to have been caused by the fact that we were using [email protected]
. This worked fine for iOS but apparently not for Android. Upgrading to [email protected]
(the listed peer-dependency version) resolved the compilation errors.
Ah great to know. I must have used some react-specific feature in the conversion functions. I'll mark this as a bug so I can remember to take a look at it. Glad that upgrading RN solved the problem.
Just a note for myself.
I recently set the peer dependency to >0.60 so I'll likely need to change that back to >0.61
Hey @cjam
We are trying to run the latest version on RN 0.60.6 and running into this build issue. Do you perhaps know which version of the lib we can downgrade to or is our only hope to upgrade to RN > 0.61?
Hey @reinhardholl , good question. Are you jettifying your project? (i.e using AndroidX). I seem to recall running into some weirdness like this until I started running the jetify on install.
@cjam yup we are. I will double check today and get back with some more feedback.
Hey @cjam; We are definitely using Jettifier but unfortunately we can't get it building on RN 0.60.6
. Any tips/suggestions from your side or is upgrading our only option?
Thanks!
I'm pretty swamped these days but if I can find some time I'll try to reproduce the issue you are having.
Upgrading to React Native 0.61.5 solved it for us. :)
That's great news. There must have been some breaking change in there that I missed. I'm not sure if there is anything I can do at this point to fix the issue for those < 0.61.5
perhaps I just need to add something to the docs about compatability.
@cjam yeah docs is a good start :) I tried having a look but we needed to upgrade anyway so we opted to just push through.