I am facing while opening my android app. I tried with below steps but I am getting this below error. Kindly help me. my Android app builds fine but when I run it I get the below error. It references a class which is not something that I use. Any ideas?
com.qa.android E/unknown:NativeModuleInitError: Failed to create NativeModule "UIManager"
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/react/uimanager/UIImplementationProvider;
at com.swmansion.reanimated.ReanimatedPackage.createUIManager(ReanimatedPackage.java:73)
at com.swmansion.reanimated.ReanimatedPackage.getModule(ReanimatedPackage.java:31)
at com.facebook.react.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:161)
at com.facebook.react.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:149)
at com.facebook.react.bridge.ModuleHolder.create(ModuleHolder.java:191)
at com.facebook.react.bridge.ModuleHolder.getModule(ModuleHolder.java:156)
at com.facebook.react.bridge.NativeModuleRegistry.getModule(NativeModuleRegistry.java:170)
at com.facebook.react.bridge.CatalystInstanceImpl.getNativeModule(CatalystInstanceImpl.java:493)
at com.facebook.react.bridge.CatalystInstanceImpl.getNativeModule(CatalystInstanceImpl.java:469)
at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:89)
at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:47)
at com.facebook.react.ReactInstanceManager.attachRootViewToInstance(ReactInstanceManager.java:1241)
at com.facebook.react.ReactInstanceManager.setupReactContext(ReactInstanceManager.java:1183)
at com.facebook.react.ReactInstanceManager.access$1600(ReactInstanceManager.java:135)
at com.facebook.react.ReactInstanceManager$5$2.run(ReactInstanceManager.java:1137)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
at android.os.Looper.loop(Looper.java:223)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
at java.lang.Thread.run(Thread.java:923)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.react.uimanager.UIImplementationProvider" on path: DexPathList[[zip file "/data/app/~~7b9OfUY0mLPaHfZSYMHhqQ==/com.qa.android-4UNR7KbO89A4FSaahSgIvw==/base.apk"],nativeLibraryDirectories=[/data/app/~~7b9OfUY0mLPaHfZSYMHhqQ==/com.qa.android-4UNR7KbO89A4FSaahSgIvw==/lib/arm64, /data/app/~~7b9OfUY0mLPaHfZSYMHhqQ==/com.qa.android-4UNR7KbO89A4FSaahSgIvw==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.swmansion.reanimated.ReanimatedPackage.createUIManager(ReanimatedPackage.java:73)
at com.swmansion.reanimated.ReanimatedPackage.getModule(ReanimatedPackage.java:31)
at com.facebook.react.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:161)
at com.facebook.react.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:149)
at com.facebook.react.bridge.ModuleHolder.create(ModuleHolder.java:191)
at com.facebook.react.bridge.ModuleHolder.getModule(ModuleHolder.java:156)
at com.facebook.react.bridge.NativeModuleRegistry.getModule(NativeModuleRegistry.java:170)
at com.facebook.react.bridge.CatalystInstanceImpl.getNativeModule(CatalystInstanceImpl.java:493)
at com.facebook.react.bridge.CatalystInstanceImpl.getNativeModule(CatalystInstanceImpl.java:469)
at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:89)
at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:47)
at com.facebook.react.ReactInstanceManager.attachRootViewToInstance(ReactInstanceManager.java:1241)
at com.facebook.react.ReactInstanceManager.setupReactContext(ReactInstanceManager.java:1183)
at com.facebook.react.ReactInstanceManager.access$1600(ReactInstanceManager.java:135)
at com.facebook.react.ReactInstanceManager$5$2.run(ReactInstanceManager.java:1137)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
at android.os.Looper.loop(Looper.java:223)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
at java.lang.Thread.run(Thread.java:923)
--------- beginning of crash
2022-11-06 01:30:47.279 20077-20173/com.qa.android E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
Process: com.qa.android, PID: 20077
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/react/uimanager/UIImplementationProvider;
at com.swmansion.reanimated.ReanimatedPackage.createUIManager(ReanimatedPackage.java:73)
at com.swmansion.reanimated.ReanimatedPackage.getModule(ReanimatedPackage.java:31)
at com.facebook.react.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:161)
at com.facebook.react.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:149)
at com.facebook.react.bridge.ModuleHolder.create(ModuleHolder.java:191)
at com.facebook.react.bridge.ModuleHolder.getModule(ModuleHolder.java:156)
at com.facebook.react.bridge.NativeModuleRegistry.getModule(NativeModuleRegistry.java:170)
at com.facebook.react.bridge.CatalystInstanceImpl.getNativeModule(CatalystInstanceImpl.java:493)
at com.facebook.react.bridge.CatalystInstanceImpl.getNativeModule(CatalystInstanceImpl.java:469)
at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:89)
at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:47)
at com.facebook.react.ReactInstanceManager.attachRootViewToInstance(ReactInstanceManager.java:1241)
at com.facebook.react.ReactInstanceManager.setupReactContext(ReactInstanceManager.java:1183)
at com.facebook.react.ReactInstanceManager.access$1600(ReactInstanceManager.java:135)
at com.facebook.react.ReactInstanceManager$5$2.run(ReactInstanceManager.java:1137)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
at android.os.Looper.loop(Looper.java:223)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
at java.lang.Thread.run(Thread.java:923)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.react.uimanager.UIImplementationProvider" on path: DexPathList[[zip file "/data/app/~~7b9OfUY0mLPaHfZSYMHhqQ==/com.qa.android-4UNR7KbO89A4FSaahSgIvw==/base.apk"],nativeLibraryDirectories=[/data/app/~~7b9OfUY0mLPaHfZSYMHhqQ==/com.qa.android-4UNR7KbO89A4FSaahSgIvw==/lib/arm64, /data/app/~~7b9OfUY0mLPaHfZSYMHhqQ==/com.qa.android-4UNR7KbO89A4FSaahSgIvw==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.swmansion.reanimated.ReanimatedPackage.createUIManager(ReanimatedPackage.java:73)
at com.swmansion.reanimated.ReanimatedPackage.getModule(ReanimatedPackage.java:31)
at com.facebook.react.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:161)
at com.facebook.react.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:149)
at com.facebook.react.bridge.ModuleHolder.create(ModuleHolder.java:191)
at com.facebook.react.bridge.ModuleHolder.getModule(ModuleHolder.java:156)
at com.facebook.react.bridge.NativeModuleRegistry.getModule(NativeModuleRegistry.java:170)
at com.facebook.react.bridge.CatalystInstanceImpl.getNativeModule(CatalystInstanceImpl.java:493)
at com.facebook.react.bridge.CatalystInstanceImpl.getNativeModule(CatalystInstanceImpl.java:469)
at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:89)
at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:47)
at com.facebook.react.ReactInstanceManager.attachRootViewToInstance(ReactInstanceManager.java:1241)
at com.facebook.react.ReactInstanceManager.setupReactContext(ReactInstanceManager.java:1183)
at com.facebook.react.ReactInstanceManager.access$1600(ReactInstanceManager.java:135)
at com.facebook.react.ReactInstanceManager$5$2.run(ReactInstanceManager.java:1137)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
at android.os.Looper.loop(Looper.java:223)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
at java.lang.Thread.run(Thread.java:923)
I implemented in this below way
if (enableHermes) {
implementation("com.facebook.react:hermes-engine: ") {
exclude group:'com.facebook.fbjni'
}
// def hermesPath = "../../node_modules/hermes-engine/android/";
// debugImplementation files(hermesPath "hermes-debug.aar")
// releaseImplementation files(hermesPath "hermes-release.aar")
} else {
implementation jscFlavor
}
I am getting crash on startup . Please kindly help me,.
CodePudding user response:
This is a known issue trending last 2 days.
add this into your android/buld.gradle
inside allprojects
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())
allprojects {
configurations.all {
resolutionStrategy {
force "com.facebook.react:react-native:" REACT_NATIVE_VERSION
}
}
}
I followed this comment https://github.com/facebook/react-native/issues/35204#issuecomment-1304281740 and it works fine now.
CodePudding user response:
Building on top of Ammar's original answer