1.react-native@0.46.4 requires a peer of react@16.0.0-alpha.12 but none was installed.
使用命令行 npm i -S react@16.0.0-alpha.12 进行install
2.Error:Conflict with dependency 'com.google.code.findbugs:jsr305'
在app的gradle文件的android下添加
configurations.all {
resolutionStrategy.force'com.google.code.findbugs:jsr305:1.3.9'
}
3.
Caused by: java.lang.IllegalAccessError: Method'void android.support.v4.net.ConnectivityManagerCompat.()'is inaccessible to class'com.facebook.react.modules.netinfo.NetInfoModule'(declaration of'com.facebook.react.modules.netinfo.NetInfoModule'appearsin/data/app/xxc.application1-1/base.apk) at com.facebook.react.modules.netinfo.NetInfoModule.(NetInfoModule.java:55) at com.facebook.react.shell.MainReactPackage.createNativeModules(MainReactPackage.java:67) at com.facebook.react.ReactInstanceManagerImpl.processPackage(ReactInstanceManagerImpl.java:793) at com.facebook.react.ReactInstanceManagerImpl.createReactContext(ReactInstanceManagerImpl.java:730) at com.facebook.react.ReactInstanceManagerImpl.access$600(ReactInstanceManagerImpl.java:91) at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:184) at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:169) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.
解决
修改 app/build.gradle
compile 'com.android.support:appcompat-v7:23.0.1''
高版的会出问题,看生成的示例项目是用这个v7包,编译环境也是23
方法来自:https://github.com/facebook/react-native/issues/6152
4.Java.lang.RuntimeException: ReferenceError: Can’t find variable: __fbBatchedBridge
检查是否在同一网段,并且端口为8081
adb reverse tcp:8081 tcp:8081
5.react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
注意文件的路径,此路径适用于WebStorm,如果为Android Studio 则不需要app签名的android,直接app开头
6.com.android.ddmlib.InstallException: Failed to install
classpath 'com.android.tools.build:gradle:1.2.3'
并且设置 Gradle 的 Wrapper为 gradle-2.2-all.zip
7. VSCode 配置好Lauch.json文件后, 并且设置断点无法debug, 打开 Enable Debug JS Remote
8. Metro Bundler can't listen on port 8081
```
sudo lsof -i :8081
kill查到的pid号
```