I am trying to create a debug build of my app in react-native. It worked previously and the problem started after I used react-native-tools extension package for VSCode text editor and attached its debugger for debugging. The error doesn't occur when I create a release build. I have removed the extension, removed my project node_modules folder and reinstalled.
The error is as follows:
08-30 13:15:42.896 6228-6491/? E/AbstractTracker: Can't create handler inside thread that has not called Looper.prepare()
08-30 13:15:42.957 25112-25112/? E/art: Failed to send JDWP packet APNM to debugger (-1 of 51): Broken pipe
08-30 13:15:42.961 25112-25118/? E/art: Failed sending reply to debugger: Broken pipe
08-30 13:15:43.052 25112-25138/? E/Theme: Different package name.com.namahapp,com.google.android.gms
08-30 13:15:43.110 25112-25151/? E/AbstractTracker: Can't create handler inside thread that has not called Looper.prepare()
08-30 13:15:43.155 18392-18909/? E/Theme: Different package name.com.facebook.katana,com.google.android.gms
08-30 13:15:43.246 18666-22557/? E/NetworkScheduler: Invalid component specified.
08-30 13:15:43.332 25112-25165/? E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
Process: com.namahapp, PID: 25112
java.lang.NoClassDefFoundError: com.facebook.react.modules.fresco.SystraceRequestListener
at com.facebook.react.modules.fresco.FrescoModule.getDefaultConfigBuilder(FrescoModule.java:149)
at com.facebook.react.modules.fresco.FrescoModule.getDefaultConfig(FrescoModule.java:138)
at com.facebook.react.modules.fresco.FrescoModule.initialize(FrescoModule.java:101)
at com.facebook.react.bridge.ModuleHolder.doInitialize(ModuleHolder.java:198)
at com.facebook.react.bridge.ModuleHolder.markInitializable(ModuleHolder.java:86)
at com.facebook.react.bridge.NativeModuleRegistry.notifyJSInstanceInitialized(NativeModuleRegistry.java:123)
at com.facebook.react.bridge.CatalystInstanceImpl$2.run(CatalystInstanceImpl.java:387)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:152)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
at java.lang.Thread.run(Thread.java:818)
The react-native version is 0.55.4. My package.json file is:
{
"name": "NamahApp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.3.1",
"react-native": "0.55.4",
"react-native-check-app-install": "0.0.4",
"react-native-fbsdk": "^0.7.0",
"react-native-firebase": "^4.2.0",
"react-native-keyboard-aware-scroll-view": "^0.6.0",
"react-native-linear-gradient": "^2.4.0",
"react-native-shadow": "^1.2.2",
"react-native-share": "^1.0.27",
"react-native-snap-carousel": "^3.7.2",
"react-native-sound": "^0.10.9",
"react-native-svg": "^6.5.0",
"react-navigation": "^2.0.1",
"socketcluster-client": "^13.0.0"
},
"devDependencies": {
"babel-jest": "22.4.3",
"babel-plugin-transform-remove-console": "^6.9.4",
"babel-preset-react-native": "4.0.0",
"jest": "22.4.3",
"react-test-renderer": "16.3.1"
},
"jest": {
"preset": "react-native"
},
"rnpm": {
"assets": [
"./app/assets/fonts/"
]
}
}
I can't make out what the error is and how to address it. Any help is appreciated. Thanks.
Update 31/08/2018
I opened the file with the error and found that the file is available in two places:
C:\Users\Nikhil\.gradle\caches\modules-2\files-2.1\com.facebook.react\react-native\0.12.0\8a53a72920675231a5d11880ae3cacb9ab91b93c\react-native-0.12.0-sources.jar!\com\facebook\react\modules\fresco\FrescoModule.java
in Users folder (Windows).G:\path\to\project\node_modules\react-native\android\com\facebook\react\react-native\0.55.0\react-native-0.55.0-sources.jar!\com\facebook\react\modules\fresco\FrescoModule.java
Out of those the file in Users
folder does not have the SystraceRequestListener.java
file.
Also, the react-native version in the path is 0.12.0. How is this getting set?? How do I change this?? I guess it should have been 0.55.4 i.e. current react-native version used in the project.
Where should I do the changes?? In Project?? or in Android studio base settings??
Please help...
Update-2 31/08/18
Removed the .gradle/cache file from Users
folder but the error still persists.
Now the error is definitely in the .gradle folder in the project.
Now need to determine why the error occurs even as the SystraceRequestListener.java
exists in the same folder as the file in which the error occurs i.e. FrescoModule.java
.
Update 03/09/18 (3rd Sept)
I reinstalled and configured all the npm packages used in the project to find when the build gets the above error, and I found that the issue occurs when I install react-native-firebase. Will update if I find some solution.
The error was emerging from the react-native-firebase package.
Updating the react-native-firebase package to the latest version resolved my problem.