'React Native Android run causes "Illegal number of arguments for updateHotspot command"
I am creating a simple app using React Native
for both iOS
and Android
. I've tested both platforms for a while and all works very well. But recently, I was focusing on iOS
and all my functionalities are working perfectly so far. But when I tried it on Android
; specifically when I tried to add an item to my existing local data in AsyncStorage
it gives me the following error:
illegal number of arguments for updateHotspot command
My app has also other functions that ads item using AsyncStorage
with no problem. But again everything works fine in iOS
.
I'm using Genymotion
(trial version) to test it in an Android
platform.
I tried to search on the Internet but found nothing. It seems to me it's a Java
thing.
Update:
I am no longer using Genymotion (trial version expired) but just the emulator from Android Studio this time.
This is the error that I received:
Solution 1:[1]
As you have mentioned you have other features in the application which seem to work perfectly fine in ios built of your application but on android side it causes you the bug! this bug is mostly relevant to
Missing some implementation command in your gradle and also not writing the command of project exporting in your setting.gradle! simply try
react-native link
if that could do that automatically else type manually and this should go away!
What is React Native link to me han?
wellReact native link tries to bind your Lib's configuration to both ios and android native code! its some time needed for some libraries/3rd party code and some time not!
It specifically targets in android system to have! exported modules in settings.gradle; along side your app level build.gradle to have implementation in dependencies and also links the library main module to your MyApplication file in java.
but here is a gotcha sometime it does not do! I think due to some poor or low standard coded libraries (no offence)! and some time process needs extra care so instead of relying on linking people like to go for manually linking ! NATIVE CODE IS TRICKY in this kind of nature you know.
bottom line
try linking! or do it manually! read the docs of last library you added before falling into a pit hole like this ! Especially in android side of the code!
Solution 2:[2]
Missing Certain Command Implementation in your Gradle.
Just try ==>
react-native link
Also I wanna tell you what is react native link
==>
React-native link is an automatic way for installing native dependencies. It is an alternative to manually linking the dependency in your project. It works for both Android and iOS
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | M.Rizwan |
Solution 2 | Shivam Shukla |