Expo构建react-native运行爆出The emulator (Pixel_3a_API_34) quit before it finished opening解决办法

一、用Expo启动一个新的React Native项目

Expo是一个生产级React Native框架。Expo提供了开发人员工具,使开发应用程序变得更加容易,例如基于文件的路由、本地模块的标准库等等。
Expo的框架是免费和开源的,在GitHub和Discord上有一个活跃的社区。Expo团队与Meta的React Native团队密切合作,为Expo SDK带来最新的React Native功能。

要创建一个新的Expo项目,请在终端中运行以下命令:

npx create-expo-app@latest

项目构建完成后,启动

npm run android

启动起来以后,模拟器展示效果:

 

二、再次启动出错

有时候再次启动的出现,一直转圈或者模拟无法启动的情况,并且终端爆出如下错误:

 红色字体的意思是:

模拟器(Pixel_3a_API_34)在完成打开之前退出。您可以尝试使用以下命令从终端手动启动模拟器:C:\Users\LENOVO\AppData\Local\Android\Sdk/emulator/emulator@Pixel_3a_API_34

我的解决办法是,打开 Android Studio编辑器,然后找到Device Manager下面的Pixel_3a_API_34,点击三个点点的,找到Wipe data 点击,wipe Data 的意思就是清除数据,具体操作如下:

 完成以后操作以后,再次运行npm run android 进行启动即可。

  • 10
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
好的,关于React Native中图片多选,可以使用react-native-image-picker这个第三方库来实现。以下是使用步骤: 1. 使用npm或者yarn安装该库:`npm install react-native-image-picker` 或者 `yarn add react-native-image-picker` 2. 在iOS中,需要执行`pod install`命令安装相关依赖库。在iOS工程目录下创建Podfile文件,输入以下内容: ``` platform :ios, '9.0' target 'YourApp' do pod 'React', :path => '../node_modules/react-native', :subspecs => [ 'Core', 'CxxBridge', 'RCTText', 'RCTNetwork', 'RCTWebSocket', 'RCTAnimation' ] pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga' pod 'react-native-image-picker', :path => '../node_modules/react-native-image-picker' end ``` 3. 在Android中,需要在AndroidManifest.xml文件中添加相关权限: ``` <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> ``` 4. 在React Native组件中导入该库: ``` import ImagePicker from 'react-native-image-picker'; ``` 5. 使用ImagePicker.launchImageLibrary方法选择图片: ``` ImagePicker.launchImageLibrary(options, (response) => { console.log('Response = ', response); if (response.didCancel) { console.log('User cancelled image picker'); } else if (response.error) { console.log('ImagePicker Error: ', response.error); } else if (response.customButton) { console.log('User tapped custom button: ', response.customButton); } else { const source = { uri: response.uri }; // You can also display the image using data: // const source = { uri: 'data:image/jpeg;base64,' + response.data }; this.setState({ avatarSource: source, }); } }); ``` 其中,options参数可以配置图片选择器的一些选项,如选择多张图片等。详细使用方法可以查看该库的官方文档。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

任磊abc

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值