Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: constructor ModuleRegistryAdapter in class ModuleRegistryAdapter cannot be applied to given types, new ModuleRegistryAdapter()

Hello im getting the fallowing error on console:

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/Users/user/Desktop/.../android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:82: error: constructor ModuleRegistryAdapter in class ModuleRegistryAdapter cannot be applied to given types;
      new ModuleRegistryAdapter(),
      ^
  required: ReactModuleRegistryProvider
  found:    no arguments
  reason: actual and formal argument lists differ in length
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

on android studio:

/Users/username/.../project_name/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:82: error: constructor ModuleRegistryAdapter in class ModuleRegistryAdapter cannot be applied to given types;
      new ModuleRegistryAdapter(),
      ^
  required: ReactModuleRegistryProvider
  found: no arguments
  reason: actual and formal argument lists differ in length

"react-native": "~0.61.5", "react-native-unimodules": "^0.9.1",

It seems a recent react-native-unimodules bug on android, any solutions? this is the same error: https://www.gitmemory.com/issue/unimodules/react-native-unimodules/58/530738183

like image 736
Esteban Contreras Avatar asked May 09 '20 23:05

Esteban Contreras


1 Answers

If you use react-native-unimodules, check if you also have "@unimodules/react-native-adapter" in your package.json. If so, try removing it and rebuild. It worked for me.

like image 188
Oswaldo Avatar answered Sep 30 '22 05:09

Oswaldo