Rim*_*och 6 react-native react-native-android react-native-image-picker
我在一加 6 上打开相机时遇到了 react-native-image-picker 和 react-native-image-crop-picker 的问题。使用打开相机时,打开相机的后台应用程序(我的应用程序)崩溃。它进入白屏并重新启动应用程序。此外,react-native log-android 中没有日志。我确实设法使用 android studio 和 logcat 发现一旦相机打开应用程序就会立即崩溃并留下一个死的进程。问题是我找不到任何实际的崩溃日志。尽管事先我收到了很多“访问被拒绝找到属性“vendor.debug.egl.swapinterval””,但经过一些研究,这些信息似乎并不相关。
目前这个问题只发生在我的一加 6T 上。这些问题不会发生在模拟器或 IOS 上。即使不是在我试过的 xiamoi 设备上。
我已经尝试了从在图像裁剪选择器中压缩图像(代码一)到尝试压缩图像并在 react-native-image-picker(代码二)中使用 noData 标志的所有方法。另外,100%有权限,甚至可以在应用权限=>{我的应用}中的android系统权限中看到它此外,我尝试清理我的一加6t相机的缓存,卸载-重新安装我的应用,并将开发者选项重置为默认。
我基本上已经解决了 github 中两个库的所有问题,但没有任何效果。
ImagePicker.openCamera({
width: 800,
height: 600,
compressImageMaxWidth: 640,
compressImageMaxHeight: 480,
compressImageQuality: 0.8
}).then(image => {
console.log(image);
}).catch(e => console.log(e));
Run Code Online (Sandbox Code Playgroud)
ImagePicker.launchCamera({noData: true, maxWidth: 800, maxHeight: 600, quality: 0.8}, (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 {
console.log(response)
}
});
Run Code Online (Sandbox Code Playgroud)
添加我的清单:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="------">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:largeHeap="true"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="true"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize"
android:launchMode="singleTop"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<service android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="io.invertase.firebase.messaging.RNFirebaseInstanceIdService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.provider" android:exported="false"
android:grantUriPermissions="true"> <meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" /> </provider>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
预期的结果是拿回承诺。并且应用程序在打开相机时不会崩溃。
很想得到一些意见。我现在有这个问题超过 2 周了。
我通过将 OxygenOS 从 9.0.4 更新到 9.0.5 使其工作。
我遇到了完全相同的问题,尝试了react-native-image-picker和react-native-image-crop-picker。它在 Android 和 iOS 模拟器上运行良好,但在设备 OnePlus 6 上运行不佳。但是当它在同事的同一部手机上运行时,事情开始变得顺利!
请务必尝试发布版本。就我而言,我必须从https://github.com/Yalantis/uCrop为 native-image-crop-picker 添加一些 ProGuard 规则
| 归档时间: |
|
| 查看次数: |
2957 次 |
| 最近记录: |