web-dev-qa-db-fra.com

Erreur: le constructeur ModuleRegistryAdapter dans la classe ModuleRegistryAdapter ne peut pas être appliqué à des types donnés, nouveau ModuleRegistryAdapter ()

Bonjour, je reçois l'erreur de mise en jachère sur la 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.

sur 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",

Il semble que ce soit un bug récent de React-Native-Unimodules sur Android, des solutions? c'est la même erreur: https://www.gitmemory.com/issue/unimodules/react-native-unimodules/58/53073818

6

Si vous utilisez react-native-unimodules, vérifiez si vous avez également "@ unimodules/react-native-adapter" dans votre package.json. Si tel est le cas, essayez de le supprimer et de le reconstruire. Cela a fonctionné pour moi.

1
Oswaldo

Dans mon cas, j'ai supprimé le "expo-react-native-adapter"

0
Bruno Sousa