react-native 遇到的坑汇总(补充中)
2017-09-29 14:32
621 查看
1.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ‘:app:installDebug’.
com.android.builder.testing.api.DeviceException: Could not create ADB Bridge. ADB location: D:\androidstudiosdk\platform-tools\adb.exe
Try:
Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output.
BUILD FAILED
Total time: 9 mins 7.292 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
解决办法:
adb devices 查看adb 是否正常
查看环境变量是否正确:D:\androidstudiosdk\platform-tools
2.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ‘:app:installDebug’.
com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Failed to finalize session : INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.blemanager signatures do not match the previously installed version; ignoring!
Try:
Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output.
BUILD FAILED
Total time: 30.235 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
3.
* failed to start daemon *
error:
Starting the app (D:\androidstudiosdk/platform-tools/adb shell am start -n com.blemanager/.MainActivity…
adb server version (31) doesn’t match this client (39); killing…
error: protocol fault (couldn’t read status): No error
* daemon started successfully *
Starting: Intent { cmp=com.blemanager/.MainActivity }
签名不同导致的安装失败,可以卸载原app后重新安装
4.
手机menu–dev settings–设置ip和端口号,ip同电脑。
5.
* failed to start daemon *
error:
adb server version (31) doesn’t match this client (39); killing…
* daemon started successfully *
error: no devices/emulators found
Sdk更新后出现了这个问题。排除端口号占用问题。最后确定是adb版本号不匹配造成的:sdk/platform-tools 下执行adb version 版本号是 1.0.39 而模拟器下的adb版本号是1.0.31 (夜神、genymotion均是),而在AndroidStudio下模拟器正常工作。
解决办法:尝试将模拟器下adb 替换为sdk下的adb,重启计算机后,仍报错。最后尝试将platform-tools下adb替换为原来的1.0.31版本,再次运行模拟器成功。
6.
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application’s support team for more information.
could not read ok from ADB Server
* failed to start daemon *
error: cannot connect to daemon
Adb 版本号与模拟器版本号不匹配导致,将adb版本号降级后解决。
解决办法:
D:\androidstudiosdk\platform-tools 下替换adb.exe
使二者版本号一致。
7.
解决办法:
方案一:
修改react-native 端口号
React-native start —port=8088
React-native run-android
方案二:
找到使用该端口号的进程,杀死。
Netstat -ano
Tasklist|findstr “8081”
Kill -9
8.
注册的应用名称和实际的不一致。
确保index.js 中AppRegistry.registerComponent(‘comDemos’, () => App); 组件名一致。
9.
在android/app/src/main 下新建文件夹assets,执行如下命令,生成index.andorid.js和index.android.bundle。需收手敲下条命令。
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/
10.
11.
Adb reverse 支持5.0以上版本
Adb devices
Adb reverse tcp:8081 tcp:8081
12.
解决办法:
使用以前的nodemodules替换当前的nodemodules,在浏览器中输入http://localhost:8081/index.android.bundle?platform=android
如果显示以下数据,则表示正常。
Could not create ADB Bridge. ADB location: **\platform-tools\adb.exe
app:installDebugFAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ‘:app:installDebug’.
com.android.builder.testing.api.DeviceException: Could not create ADB Bridge. ADB location: D:\androidstudiosdk\platform-tools\adb.exe
Try:
Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output.
BUILD FAILED
Total time: 9 mins 7.292 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
解决办法:
adb devices 查看adb 是否正常
查看环境变量是否正确:D:\androidstudiosdk\platform-tools
2.
com.android.ddmlib.InstallException: Failed to finalize session : INSTALL_FAILED_UPDATE_INCOMPATIBLE
installDebug FAILEDFAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ‘:app:installDebug’.
com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Failed to finalize session : INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.blemanager signatures do not match the previously installed version; ignoring!
Try:
Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output.
BUILD FAILED
Total time: 30.235 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
3.
ADB server didn’t ACK * failed to start daemon *
ADB server didn’t ACK* failed to start daemon *
error:
Starting the app (D:\androidstudiosdk/platform-tools/adb shell am start -n com.blemanager/.MainActivity…
adb server version (31) doesn’t match this client (39); killing…
error: protocol fault (couldn’t read status): No error
* daemon started successfully *
Starting: Intent { cmp=com.blemanager/.MainActivity }
签名不同导致的安装失败,可以卸载原app后重新安装
4.
could not connect to development server
手机menu–dev settings–设置ip和端口号,ip同电脑。
5.
adb server is out of date. killing…
ADB server didn’t ACK* failed to start daemon *
error:
adb server version (31) doesn’t match this client (39); killing…
* daemon started successfully *
error: no devices/emulators found
Sdk更新后出现了这个问题。排除端口号占用问题。最后确定是adb版本号不匹配造成的:sdk/platform-tools 下执行adb version 版本号是 1.0.39 而模拟器下的adb版本号是1.0.31 (夜神、genymotion均是),而在AndroidStudio下模拟器正常工作。
解决办法:尝试将模拟器下adb 替换为sdk下的adb,重启计算机后,仍报错。最后尝试将platform-tools下adb替换为原来的1.0.31版本,再次运行模拟器成功。
6.
adb server version (31) doesn’t match this client (39); killing…
error: could not install smartsocket listener: cannot bind to 127.0.0.1:5037: 通常每个套接字地址(协议/网络地址/端口)只允许使用一次。 (10048)This application has requested the Runtime to terminate it in an unusual way.
Please contact the application’s support team for more information.
could not read ok from ADB Server
* failed to start daemon *
error: cannot connect to daemon
Adb 版本号与模拟器版本号不匹配导致,将adb版本号降级后解决。
解决办法:
D:\androidstudiosdk\platform-tools 下替换adb.exe
使二者版本号一致。
7.
Packager can’t listen on port 8081
端口号8081被占用。解决办法:
方案一:
修改react-native 端口号
React-native start —port=8088
React-native run-android
方案二:
找到使用该端口号的进程,杀死。
Netstat -ano
Tasklist|findstr “8081”
Kill -9
8.
Application * has not been registered.
注册的应用名称和实际的不一致。
确保index.js 中AppRegistry.registerComponent(‘comDemos’, () => App); 组件名一致。
9.
unable to load script from assets ‘index.android bundle’ ,make sure your bundle is packaged correctly or youu’re runing a packager server
在android/app/src/main 下新建文件夹assets,执行如下命令,生成index.andorid.js和index.android.bundle。需收手敲下条命令。
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/
10.
undefined is not an object
检查提示文件/相关文件是否有语法错误。11.
Could not run adb reverse: Command failed:
D:\androidstudiosdk/platform-tools/adb -s 192.168.103.101:5555 reverse tcp:8081 tcp:8081Adb reverse 支持5.0以上版本
Adb devices
Adb reverse tcp:8081 tcp:8081
12.
Cannot find entry file index.android.js in any of the roots
Index.android.js存在,却频频提示找不到。解决办法:
使用以前的nodemodules替换当前的nodemodules,在浏览器中输入http://localhost:8081/index.android.bundle?platform=android
如果显示以下数据,则表示正常。
相关文章推荐
- react-native遇到的问题
- 通过creact-react-native-app构建项目遇到的坑
- ReactNative---遇到的错误4
- react native 嵌入原生 遇到的问题,以及解决
- react native资料汇总
- react-native 热更新react-native-pushy集成遇到的问题
- React Native 之安装过程及遇到的问题
- React Native 环境配置遇到的坑
- 集成 jpush-react-native 常见问题汇总 (iOS 篇)
- React Native插件系列之插件汇总
- 关于react-native遇到Can't find variable: TouchableHighlight
- react-native android 调试 遇到的坑(持续更新)
- React Native 初学之遇到的错误记录
- react-native 打包遇到aapt错误解决方案
- React native 上传图片遇到的问题
- 第一次开始入手React-Native ,记录一下自己遇到的坑
- react-native-fs插件的使用以及遇到的坑
- mac 底下,配置 React-Native 遇到的一些问题
- 关于react-native 运行项目中遇到could not connect to development server的问题