[🐛] Incompatible types: ReadableMap cannot be converted to WritableMap

See original GitHub issue

Install library, compile with android studio, receive error from Android Studio on the file Utils.java:

error: incompatible types: ReadableMap cannot be converted to WritableMap assets.pushMap(getImageResponseMap(uri, options, context));

image

WORKAROUND

If you follow the suggestion made by android studio you can cast the method as “(WritableMAp)”

assets.pushMap((WritableMap) getImageResponseMap(uri, options, context));

and

assets.pushMap((WritableMap) getVideoResponseMap(uri, context));

image

  • Image Picker version: 4.0.3
  • React Native version: 0.60.6
  • Platform: Android
  • Development Operating System: Mas OS Big Sur (Intel)
  • Dev tools: Android Studio: 4.2.1, Compile SDK: 29, Gradle: 6.2, Android Gradle Plugin Version 3.5.3

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:11

github_iconTop GitHub Comments

2reactions
AbhiSNSoftcommented, Jun 3, 2022

Almost 1 year & haven’t fixed this?

2reactions
Carl0395commented, Jun 25, 2021

I change the return of getImageResponseMap and getVideoResponseMap for WritableMap in node_modules/react-native-image-picker/android/src/main/java/com/imagepicker/Utils.java and fixed for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

error: incompatible types: Task cannot be converted to Uri
You are getting the following error: incompatible types: Task cannot be converted to Uri. Because ref.getDownloadUrl() return a Task object ...
Read more >
Sealed Class In Kotlin Incompatible Types Error - ADocLib
.error: incompatible types: ReadableMap cannot be converted to WritableMap map.putMapplaybackOptions Convert.toMapplayerState. Introduce a normal compiler issue ...
Read more >
Example usage for com.facebook.react.bridge ReadableMap ...
getMap(key)); break; case Array: result = toList(readableMap.getArray(key)); break; default: AdjustFactory.getLogger().error("Could not convert object with ...
Read more >
react-native-image-picker - Bountysource
Bug. When press the shoot button as soon as the camera opens, ... reason: '*** -[__NSDictionaryM setObject:forKey:]: object cannot be nil (key: data)' ......
Read more >
how to fix : android error: incompatible types ... - YouTube
how to fix : android error : incompatible types : anonymous Callback cannot be converted to Context.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found