您好我正在尝试在我的反应本机项目上运行'yarn android'。我遇到了以下错误:
yarn android v0.27.5
$ react-native-scripts android
10:37:45 AM: Starting packager...
10:39:34 AM: Starting Android...
10:39:37 AM: Packager started!
To view your app with live reloading, point the Expo app to this QR code.
You'll find the QR scanner on the Projects tab of the app.
<QR CODE>
Or enter this address in the Expo app's search bar:
exp://172.19.29.31:19000
Your phone will need to be on the same local network as this computer.
For links to install the Expo app, please visit https://expo.io.
Logs from serving your app will appear here. Press Ctrl+C at any time to stop.
Error running adb: Error running app. Error: Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=exp://172.19.29.31:19000 flg=0x10000000 }
(node:28009) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'length' of null
我使用create-react-native-app生成器来设置我的应用程序,这是我的项目结构:
<username>$ls
App.js app.json gen package.json
App.test.js assets my-app-key.keystore stylesheet.js
README.md components node_modules yarn.lock
我还尝试使用我的expo应用程序扫描qr代码以在我的手机上运行我的应用程序,但它达到100%然后崩溃了应用程序,或者它给出了深蓝色屏幕,其中错误是“Uncaught Error” “Packager未在http :: 19003上运行”(即使我扫描的端口是http:19000)。
我刚刚尝试运行'npm start'然后'a'为android选项但是我收到了消息: 上午11:40:20:启动Android ...
Error running adb: Error running app. Error: Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=exp://172.19.29.31:19000 flg=0x10000000 }
› Press a to open Android device or emulator, or i to open iOS emulator.
› Press q to display QR code.
› Press r to restart packager, or R to restart packager and clear cache.
› Press d to toggle development mode. (current mode: development)
(node:31496) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'length' of null
11:43:30 AM: Running app on SM-T560NU in development mode
11:44:01 AM: [sane] Warning: Lost connection to watchman, reconnecting..
任何人都可以帮我解决这个问题吗?
答案 0 :(得分:0)
确保您在模拟器上使用的是最低限度的API 19,以某种方式对我有效。
答案 1 :(得分:0)
您可能需要重新安装android应用,您可以使用expo install:android
进行安装,然后尝试再次打开它
答案 2 :(得分:0)
尝试删除apk
rm -rf ~/.expo/android-apk-cache
来源:https://www.bountysource.com/issues/43329081-error-staring-android-emulator