权限都有配置
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32"/>
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_VISUAL_USER_SELECTED"/>
也有引入在libs
uni-media-release.aar
nativeobj-preview-release.aar
也有引入
com.github.bumptech.glide:glide:4.9.0
androidx.recyclerview:recyclerview:1.0.0
androidx.appcompat:appcompat:1.6.1
androidx.activity:activity-ktx:1.9.2
这个是完整的
implementation "androidx.core:core-ktx:1.10.1"
implementation "androidx.recyclerview:recyclerview:1.3.2"
implementation "androidx.appcompat:appcompat:1.0.0"
implementation "androidx.exifinterface:exifinterface:1.3.6"
implementation "androidx.localbroadcastmanager:localbroadcastmanager:1.0.0@aar"
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
implementation "androidx.webkit:webkit:1.6.0"
implementation "com.google.android.material:material:1.4.0"
implementation "androidx.viewpager2:viewpager2:1.1.0-beta02"
implementation "com.alibaba:fastjson:1.2.83"
implementation "com.facebook.fresco:fresco:3.4.0"
implementation "com.facebook.fresco:middleware:3.4.0"
implementation "com.facebook.fresco:animated-gif:3.4.0"
implementation "com.facebook.fresco:webpsupport:3.4.0"
implementation "com.facebook.fresco:animated-webp:3.4.0"
implementation "com.caverock:androidsvg:1.4"
implementation "com.github.bumptech.glide:glide:4.9.0"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
implementation "org.jetbrains.kotlin:kotlin-reflect:2.2.0"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1"
implementation "com.squareup.okhttp3:okhttp:3.12.12"
implementation "com.github.getActivity:XXPermissions:18.63"
implementation "net.lingala.zip4j:zip4j:2.11.5"
implementation "androidx.activity:activity-ktx:1.9.2"
//uni-camera
implementation "androidx.camera:camera-core:1.4.1"
implementation "androidx.camera:camera-camera2:1.4.1"
implementation "androidx.camera:camera-lifecycle:1.4.1"
implementation "androidx.camera:camera-view:1.4.1"
implementation "androidx.appcompat:appcompat:1.7.0"
//uni-barcode-scanning
implementation "com.google.mlkit:barcode-scanning:17.2.0"
implementation "com.github.albfernandez:juniversalchardet:2.0.4"
//uni-media
implementation "androidx.recyclerview:recyclerview:1.0.0"
implementation "androidx.appcompat:appcompat:1.6.1"
//uni-fileSystemManager
implementation "org.brotli:dec:0.1.2"
buildConfigField 为
buildConfigField 'String', 'UTSEasyCom', '"[' +
'{\"class\":\"uts.sdk.modules.DCloudUniModal.UniModalExtApiPagesRegister\",\"method\":\"register\"},' +
'{\"class\":\"uts.sdk.modules.DCloudUniCamera.UniCameraExtApiComponentsRegister\",\"method\":\"register\"},' +
'{\"class\":\"uts.sdk.modules.DCloudUniScanCode.UniScanCodeExtApiPagesRegister\",\"method\":\"register\"},' +
'{\"class\":\"uts.sdk.modules.DCloudUniMedia.UniMediaExtApiPagesRegister\",\"method\":\"register\"},' +
'{\"class\":\"uts.sdk.modules.DCloudUniActionSheet.UniActionSheetExtApiPagesRegister\",\"method\":\"register\"},' +
'{\"class\":\"uts.sdk.modules.DCloudUniPreviewImage.UniPreviewImageExtApiPagesRegister\",\"method\":\"register\"},' +
'{\"class\":\"uts.sdk.modules.DCloudUniFileSystemManager.UniFileSystemManagerExtApiPagesRegister\",\"method\":\"register\"}' +
']"'
当前扫码是可以使用的
2 个回复
Ask小助手
uni-app x 离线打包后 uni.chooseImage 点击无反应,可能原因及解决方案如下:
权限配置格式问题
根据优先知识库,Android 11+ 需要使用
excludePermissions配置而非直接声明权限。请检查 manifest.json 是否按以下格式配置:直接在 AndroidManifest.xml 添加权限可能导致冲突。
插件初始化验证
确保
uni-media插件已正确注册。检查 build.gradle 中是否包含:若已配置,尝试清除项目缓存后重新离线打包。
Android 13+ 特殊处理
Android 13 引入
READ_MEDIA_VISUAL_USER_SELECTED权限,需在代码中动态请求:调试建议
adb logcat查看设备日志,搜索 "UniMedia" 相关错误uni.chooseImage调用测试若仍无法解决,建议在 DCloud issue 系统 提交问题,提供具体设备型号、Android 版本和完整错误日志。同时可尝试在插件市场搜索替代图片选择插件。
996sm (作者)
多加了一个 {\"class\":\"uts.sdk.modules.DCloudUniMedia.UniMediaExtApiPagesRegister\",\"method\":\"register\"} 删除就正常了
要回复问题请先登录或注册
公告
更多>相关问题