infinitered / reactotron

A desktop app for inspecting your React JS and React Native projects. macOS, Linux, and Windows.
https://docs.infinite.red/reactotron/
MIT License
14.95k stars 946 forks source link

Can't connect to genymotion , please help #634

Closed hiheaven closed 6 years ago

hiheaven commented 6 years ago

I am new to android development. Bought an app and they say app is already configured with reactotron and ready to go. But I can't connect .

App.js

import React from 'react'; import {AsyncStorage} from 'react-native' import {Images, Constants} from '@common'; import Expo, {Font} from 'expo'; import RootRouter from './src/Router'; import Reactotron from 'reactotron-react-native' import './ReactotronConfig' import {Provider, connect} from 'react-redux'; import thunk from 'redux-thunk'; import reducers from '@redux'; import {createStore, compose, applyMiddleware} from 'redux'; import {persistStore} from 'redux-persist' import {PersistGate} from 'redux-persist/es/integration/react'

let store = null; const middleware = [thunk];

if (DEV) { if (Constants.useReactotron) { store = Reactotron.createStore(reducers, {}, applyMiddleware(...middleware)); } else { const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; store = composeEnhancers(applyMiddleware(...middleware))(createStore)(reducers);

    if (module.hot) {
        // Enable Webpack hot module replacement for reducers
        module.hot.accept(reducers, () => {
            const nextRootReducer = reducers;
            store.replaceReducer(nextRootReducer);
        });
    }

    // show network react-native-debugger
    // global.XMLHttpRequest = global.originalXMLHttpRequest ?
    //     global.originalXMLHttpRequest :
    //     global.XMLHttpRequest;
    // global.FormData = global.originalFormData ?
    //     global.originalFormData :
    //     global.FormData;
}

} else { store = compose(applyMiddleware(...middleware))(createStore)(reducers); }

let persistor = persistStore(store)

export default class App extends React.Component {

state = {appIsReady: false};

componentWillMount() {
    this.loadAssets();
    console.ignoredYellowBox = ['Warning: View.propTypes', 'Warning: BackAndroid'];
    if (__DEV__) {
        Reactotron.connect()
        Reactotron.clear()
    }
}

ReactotronConfig.js

import Reactotron from 'reactotron-react-native' import { reactotronRedux as reduxPlugin } from 'reactotron-redux'

console.disableYellowBox = true console.ignoredYellowBox = ['Warning: flexWrap:wrap``'];

Reactotron.configure({name: 'MStore'})

Reactotron.useReactNative({ asyncStorage: { ignore: ['secret'] } })

Reactotron.use(reduxPlugin())

console.tron = Reactotron


index.android.js

import React from 'react';

import {AppRegistry} from 'react-native'; import ReduxWrapper from './src/ReduxWrapper';

AppRegistry.registerComponent('mstore', () => ReduxWrapper);

When i did "react-native run-android", get this, but the app comes up OK: ... BUILD SUCCESSFUL in 7s 179 actionable tasks: 1 executed, 178 up-to-date Running C:\Users\ASUS\AppData\Local\Android\Sdk/platform-tools/adb -s 192.168.251.101:5555 reverse tcp:8081 tcp:8081 error: closed Could not run adb reverse: Command failed: C:\Users\ASUS\AppData\Local\Android\Sdk/platform-tools/adb -s 192.168.251.101:5555 reverse tcp:8081 tcp:8081 Starting the app on 192.168.251.101:5555 (C:\Users\ASUS\AppData\Local\Android\Sdk/platform-tools/adb -s 192.168.251.101:5555 shell am start -n com.inspireui.mstore/com.inspireui.mstore.MainActivity)... Starting: Intent { cmp=com.inspireui.mstore/.MainActivity }


skellock commented 6 years ago

Does adb reverse tcp:9090 tcp:9090 work?

hiheaven commented 6 years ago

when do : "adb reverse tcp:9090 tcp:9090" get : "error: closed"

do: adb devices get: List of devices attached 192.168.251.101:5555 device

skellock commented 6 years ago

Maybe it's this on your computer?

adb -s 192.168.251.101:5555 reverse tcp:9090 tcp:9090

I don't use genymotion, so I can't tell you for sure.

I know it used to work but it relies on a specific network address, so if your NAT isn't set up on Genymotion, it may cause problems.

Judging from your log files, it looks like that might be it though.

hiheaven commented 6 years ago

hi Shellock, thanks for your help.

I did : adb -s 192.168.251.101:5555 reverse tcp:9090 tcp:9090 get: "error: closed"

don't know that that means!

skellock commented 6 years ago

me either. is your emulator up & running? is it running android 5 or higher?

hiheaven commented 6 years ago

i only have "Google galaxy Nexus 4.1.1 API 16 - 720x1280" as the simulator

skellock commented 6 years ago

adb reverse is only available on Android 5 and up. You should be able to put the host in your configure block and connect directly though. Give that a shot.

hiheaven commented 6 years ago

sorry, but what it the name of the configure block file? I tried to find , but can't. thanks

skellock commented 6 years ago

Min your source code wherever you setup reactotron you call the configure function. Pass in the host key with your computers ip.

skellock commented 6 years ago

Closing due to inactivity. If you're still stuck, can you post some code online so I can look? Thanks!

MrJxySteven commented 5 years ago

Can you speak Chinese? I need your help. Please reply as soon as possible

@1U~M QFD28D)O)V~)%5W8

1JSIIUUG U`P%QSCE2 $%R