react-native run- 出错

1.react-native run-android 出现以下错误


Starting: Intent { cmp=com.xxx/.MainActivity }
Error type 3
Error: Activity class {com.xxx/com.xxx.MainActivity} does not exist.

错误原因:AndroidManifest和app.build.gradle中的包名不同
package="com.xxx"
applicationId "com.packageName"

因为app使用的包名是applicationId 可以使用以下方式运行
react-native run-android --appId com.packageName

2.react-native run-ios 出现以下错误

Could not find iPhone X simulator

修改node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js

if (!version.startsWith('iOS')
if (!version.startsWith('com.apple.CoreSimulator.SimRuntime.iOS')


你可能感兴趣的:(react-native run- 出错)