liubobuzhidao

ReactNative之国产机红米note2的坑

参考资料:

1
2
3
http://blog.csdn.net/eric_niezhangyu/article/details/51692297
http://www.jianshu.com/p/0e768f6a83c2

情况是这样:RN开发测试的过程中发现同事的红米note2运行结果死活和别人的不一样,出现的问题如下:

  • 1、连接数据线没法调试 ,使用adb reverse tcp:8081 tcp:8081 报错:more than one device and emulator ,明明只有一个设备非得整出两个来,不用说这个锅小米肯定得背!接下来怎么搞?网上找了不少 但是都没什么效果,最后没办法 只能重启手机了,发现好了。。。。[同事的手机之前调试过,启用MIUI优化已关闭]

  • 2、本以为这下该可以了吧 ,执行一下react-native run-android ,又报错:

    com.android.ddmlib.InstallException: Failed to establish session

这个问题相对上个来讲还是挺多答案的:

1
2
3
4
5
6
7
8
9
For Mi devices
for those who suffer from this:
1、enable developer mode - In your phone, go to Settings, About phone and click on MIUI version 7 times. You’ll see a pop up which says you are a developer now.
2、Go back to Settings, Additional settings, Developer options and enable USB Debugging.
3、Connect your phone to your PC/Mac and on the phone authorize your computer
4、go back to Developer options, scroll down to find Turn on MIUI optimization and disable it. Your phone will be rebooted
5、Try it now :)