如何解决访问图库 Android 11 时出现问题 - 访问被拒绝,无法保存裁剪后的图像
也许有人已经遇到过这个问题并找到了解决方法
我有一个使用cordova-android - 9 和targetSdkVersion - 29 构建的应用
当我在使用裁剪器处理照片后尝试从相机获取照片时,出现错误:“访问被拒绝,无法保存裁剪后的图像”
我已经在 app\src\main\AndroidManifest.xml 中尝试了权限 WRITE_EXTERNAL_STORAGE、READ_EXTERNAL_STORAGE、MANAGE_EXTERNAL_STORAGE 我还添加了 android: requestLegacyExternalStorage="true"
在 app\build.gradle 中添加了 compileSdkVersion 29 和 targetSdkVersion 29
我阅读了大量关于 developer.android 的文档,尝试了来自 github 和 stackoverflow 的解决方案,但不幸的是没有任何效果
如果有人知道问题的解决方案,请帮忙。我将不胜感激任何想法或解决方案的提示
我的 AndroidManifest.xml:
...
<application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true">
...
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<uses-feature android:name="android.hardware.location" />
<uses-feature android:name="android.hardware.location.gps" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" android:required="false" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />
<uses-permission android:name="android.permission.VIBRATE" />
...
build.gradle:
...
android {
defaultConfig {
versionCode cdvVersionCode ?: new BigInteger("" + privateHelpers.extractIntFromManifest("versionCode"))
applicationId privateHelpers.extractStringFromManifest("package")
if (cdvMinSdkVersion != null) {
minSdkVersion cdvMinSdkVersion
}
if (cdvMaxSdkVersion != null) {
maxSdkVersion cdvMaxSdkVersion
}
if(cdvTargetSdkVersion != null) {
targetSdkVersion cdvTargetSdkVersion
}
}
...
config.xml:
...
<plugin name="es6-promise-plugin" spec="^4.2.2" />
<plugin name="cordova-plugin-add-swift-support" spec="^2.0.2" />
<plugin name="cordova-plugin-android-permissions" spec="^1.0.0" />
<plugin name="cordova-plugin-device-motion" spec="^2.0.1" />
<plugin name="cordova-plugin-file" spec="^6.0.1" />
<plugin name="cordova-plugin-file-transfer" spec="^1.7.1" />
<plugin name="cordova-plugin-network-information" spec="^2.0.1" />
<plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />
<plugin name="cordova-plugin-touch-id" spec="^3.4.0">
<variable name="FACEID_USAGE_DESCRIPTION" value="For quick authentication." />
</plugin>
<plugin name="cordova-plugin-contacts" spec="^3.0.1">
<variable name="CONTACTS_USAGE_DESCRIPTION" value="Your contact list data will be sent to the server and used to check if your contacts are using this application." />
</plugin>
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
<plugin name="cordova-plugin-appavailability" spec="^0.4.2" />
<plugin name="cordova-plugin-ios-keychain" spec="~3.0.1" />
<plugin name="cordova-plugin-camera" spec="^4.0.3">
<variable name="CAMERA_USAGE_DESCRIPTION" value="The camera is used to scan QR codes." />
<variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="This app requires photo library access to function properly." />
</plugin>
<plugin name="cordova-plugin-listpicker" spec="^2.2.2" />
<plugin name="cordova-plugin-ionic-webview" spec="^4.1.0" />
<plugin name="cordova-plugin-android-fingerprint-auth" spec="~1.5.0" />
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.1.3" />
<plugin name="cordova-plugin-statusbar" spec="~2.4.3-dev" />
<plugin name="cordova-android-support-gradle-release" spec="^3.0.0">
<variable name="ANDROID_SUPPORT_VERSION" value="27.+" />
</plugin>
<plugin name="cordova-plugin-decimal-keyboard-wkwebview" spec="~1.0.3" />
<plugin name="cordova-plugin-qrscanner" spec="^3.0.1" />
<plugin name="cordova-plugin-card-io" spec="~2.1.1" />
<plugin name="cordova-plugin-secure-key-store" spec="~1.5.4" />
<plugin name="cordova-plugin-vibration" spec="~3.1.1" />
<plugin name="cordova-plugin-shortcuts-android" spec="~0.1.0" />
<plugin name="cordova-plugin-cutout" spec="~1.0.10" />
...
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。