[Android] Cannot read property 'debugHosts' of undefined
See original GitHub issueHi There, i just did a vanilla installation for the realm specified here. However, i got this exception. Below is a screenshot of the app. I was not able to launch it at all. If i remove the constructor for Realm the app works.
Steps Followed:
- react-native init <project-name>
- npm install --save realm
- rnpm link realm
- react-native run-android
package.json
{
"name": "Realm14",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start"
},
"dependencies": {
"react": "15.2.1",
"react-native": "^0.29.0",
"realm": "^0.14.1"
}
}
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:20 (1 by maintainers)
Top Results From Across the Web
Cannot read property 'debugHosts' of undefined #1150 - GitHub
I have the problem "Cannot read property 'debugHosts' of undefined", I know this issue was closed but I believe it comes back again....
Read more >react native - Cannot read property 'debugHosts' of undefined
Steps to fix: rnpm link realm. Add the module in the MainApplication.Java file, should look like this @Override protected List<ReactPackage> ...
Read more >Cannot read property 'debugHosts' of undefined -
I have the problem "Cannot read property 'debugHosts' of undefined", I know this issue was closed but I believe it comes back again....
Read more >Cannot read property 'debugHosts' of undefined-React Native
Coding example for the question Cannot read property 'debugHosts' of undefined-React Native.
Read more >error cannot read property 'configurations' of undefined. react ...
I think the important part that I was missing even previously is to run pod install for iOS. For Android, the reason it...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed by closing react-native packager again, closing simulator and running npm cache clean, npm start and react-native run-ios
I get into the same issue, here how I solved it:
As @gasperz says, the issue is related to
react-native: 0.29+
breaks compatibility, they added support for a new file calledMainApplication.java
, so,Event running
rnpm link realm
usingrnpm v1.9.0
do not fix, why? when you run the linkrnpm
it only updates the fileMainActivity.java
not the new one, I don’t know why, but I have installed the lastest verion ofrnpm
, run the link and it only changed the old one adding the import line:So, just move that line to
MainApplication.java
and add the package to the list returned as @octohedron has said.Another issue you could have is this:
Just go to
./android.settings.grandle
and add this:Hope that help…