简书链接:reactnative记录与错误汇总
文章字数:476,阅读全文大约需要1分钟

1
2
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
cd android && ./gradlew assembleRelease
1
adb logcat *:S ReactNative:V ReactNativeJS:V

unsupported top level event type dispatched androidthe development server renturned error code 500

8:56.249 29147-29196/com.nativeview E/ReactNativeJS: Module RCTEventEmitter is not a registered callable module (calling receiveTouches)

undefined is not an object (evaluating ‘_react2.PropTypes.bool’) 导入错误

m.facebook.react.common.DebugServerException: The development server returned response error code: 500 入口错误

eactNativeJS: Invariant Violation: View config not found for name NKeyBoardTextInput

684-1733/com.nativeview E/ReactNativeJS: Error: NKeyBoardTextInput has no propType for native prop NKeyBoardTextInput.nativeID of native type String
If you haven’t changed this prop yourself, this usually means that your versions of the native code and JavaScript code are out of sync. Updating both should make this error go away.

eJS: Error: NKeyBoardTextInput has no propType for native prop NKeyBoardTextInput.styleStandardFilePath of native type String
If you haven’t changed this prop yourself, this usually means that your versions of the native code and JavaScript code are out of sync. Updating both should make this error go away.

nknown:ReactNative: Exception in native call
com.facebook.react.common.DebugServerException: The development server returned response error code: 500

                   URL: http://localhost:8081/index.delta?platform=android&dev=true&minify=false

打开这个网址就能看到详细错误了。

type: “TransformError”,
snippet: “  48 |   49 |  _onChange(e):{ > 50 |  consone.debug(”onChange:”);  |  ^  51 |  }  52 |   53 |  render() {”,
lineNumber: 50,
column: 15,
filename: “D:\test\back-ji\NativeView\App.js”,
errors: [
{
description: “SyntaxError in D:\test\back-ji\NativeView\App.js: D:/test/back-ji/NativeView/App.js: Unexpected token, expected : (50:15)”,
filename: “D:\test\back-ji\NativeView\App.js”,
lineNumber: 50
}
],
name: “SyntaxError”,
message: “SyntaxError in D:\test\back-ji\NativeView\App.js: D:/test/back-ji/NativeView/App.js: Unexpected token, expected : (50:15)”,
stack: “SyntaxError: D:/test/back-ji/NativeView/App.js: Unexpected token, expected : (50:15)   48 |   49 |  _onChange(e):{ > 50 |  consone.debug(”onChange:”);  |  ^  51 |  }  52 |   53 |  render() { at Parser.pp$5.raise (D:\test\back-ji\NativeView\node_modules\babylon\lib\index.js:4454:13) at Parser.pp.unexpected (D:\test\back-ji\NativeView\node_modules\babylon\lib\index.js:1761:8) at Parser.pp.expect (D:\test\back-ji\NativeView\node_modules\babylon\lib\index.js:1749:33) at Parser.pp$8.flowParseTypeInitialiser (D:\test\back-ji\NativeView\node_modules\babylon\lib\index.js:4986:8) at Parser.pp$8.flowParseObjectType (D:\test\back-ji\NativeView\node_modules\babylon\lib\index.js:5492:29) at Parser.pp$8.flowParsePrimaryType (D:\test\back-ji\NativeView\node_modules\babylon\lib\index.js:5660:19) at Parser.pp$8.flowParsePostfixType (D:\test\back-ji\NativeView\node_modules\babylon\lib\index.js:5778:19) at Parser.pp$8.flowParsePrefixType (D:\test\back-ji\NativeView\node_modules\babylon\lib\index.js:5795:17) at Parser.pp$8.flowParseAnonFunctionWithoutParens (D:\test\back-ji\NativeView\node_modules\babylon\lib\index.js:5800:20) at Parser.pp$8.flowParseIntersectionType (D:\test\back-ji\NativeView\node_modules\babylon\lib\index.js:5815:19)”
}

这里应该是复写onChange出现的错误

http://localhost:8081/debugger-ui/

rt.WebsocketJavaScriptExecutor$WebsocketExecutorTimeoutException: Timeout while connecting to remote debugger

依然是一样的道理打开
http://localhost:8081/index.delta?platform=android&dev=true&minify=false
查看是否有错误信息。
另外开发工具是最牛逼的,语法错误马上能查出来

Metro Bundler can’t listen on port 8081
编译

1
gradlew clean assembleRelease