两个问题,简单的记录。
1是按照RN中文网上的步骤将js嵌入到原生应用中后,不显示js的页面。即在npm start之后
npm start > rndemo@1.0.0 start /Users/MPP/AndroidStudioProjects/RNDemo/RNDemo1 > node node_modules/react-native/local-cli/cli.js start Scanning 431 folders for symlinks in /Users/MPP/AndroidStudioProjects/RNDemo/RNDemo1/node_modules (11ms) ┌────────────────────────────────────────────────────────────────────────────┐ │ Running packager on port 8081. │ │ │ │ Keep this packager running while developing on any JS projects. Feel │ │ free to close this tab and run your own packager instance if you │ │ prefer. │ │ │ │ https://github.com/facebook/react-native │ │ │ └────────────────────────────────────────────────────────────────────────────┘ Looking for JS files in /Users/MPP/AndroidStudioProjects/RNDemo/RNDemo1 [01/19/2017,16:31:30] <START> Initializing Packager [01/19/2017,16:31:30] HMR Server listening on /hot React packager ready. [01/19/2017,16:31:35] <START> Building Haste Map [01/19/2017,16:31:35] <END> Building Haste Map (56ms) [01/19/2017,16:31:35] <END> Initializing Packager (4729ms)
执行到这一步后,直接run到手机上。然而手机加载不出来js页面。而且用的是魅族手机。怎么晃动都没有弹出开发者菜单的悬浮窗。估计是手机问题。然后启动了一个模拟器后,提示要获取 悬浮窗权限。允许后可以成功加载。并且有请求jsbundle的动作
[01/19/2017,16:33:40] <START> Requesting bundle bundle_url: /index.android.bundle?platform=android&dev=true&hot=false&minify=false [01/19/2017,16:33:40] <START> Transforming files transformed 388/388 (100%) [01/19/2017,16:33:40] <END> Transforming files (769ms) [01/19/2017,16:33:41] <END> Requesting bundle (899ms) bundle_url: /index.android.bundle?platform=android&dev=true&hot=false&minify=false [01/19/2017,16:33:53] <START> Requesting bundle bundle_url: /index.android.bundle?platform=android&dev=true&hot=false&minify=false [01/19/2017,16:33:53] <END> Requesting bundle (19ms) bundle_url: /index.android.bundle?platform=android&dev=true&hot=false&minify=false然后 回到手机上,找到应用,发现悬浮窗权限是被禁用了。(我在manifest文件里声明过获取这个权限的,而且不是dangerous权限 不知道为啥没有提示我开启。魅族定制的rom) 之后,弹出熟悉的血色界面了。然后重置了一下端口号,js界面加载出来了。。。。
2另一个问题是我手机不弹出开发者菜单的问题。尼玛晃得手臂都快断了 就是不出来。后来发现可以通过命令开启。命令
adb shell input keyevent 82然后看见那个界面了。。。。。。。写的很乱