z***@qq.com
z***@qq.com
  • 发布:2020-05-29 11:37
  • 更新:2020-05-29 11:37
  • 阅读:2390

【报Bug】华为平板 打开拍照或拍视频,选取或返回,APP会闪退

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win10

HBuilderX类型: 正式

HBuilderX版本号: 2.7.9

手机系统: Android

手机系统版本号: Android 10

手机厂商: 华为

手机机型: HUAWEI M6

页面类型: vue

打包方式: 云端

项目创建方式: HBuilderX

示例代码:

华为平板 打开拍照或拍视频,选取或返回,APP会闪退

操作步骤:

有时候拍照和拍视频都会出现闪退

预期结果:

正常拍照和拍视频

实际结果:

有时候会出现闪退

bug描述:

华为平板 打开拍照或拍视频,选取或返回,APP会闪退。同一个型号的手机(HUAWEI M6), 一个运行内存 4.0GB, 一个6.0GB, 4.0GB这个平板很容易出现拍照或拍视频,APP闪退,然后重启APP,在联机测试和打正式包安装测试都会有这样的情况。

<view class="remarks_show">  
                <view class="remarks_item">  
                    <view class="item_title font24 color_4A5260">  
                        二、边坡变形调查  
                    </view>  
                    <!-- 图片 -->  
                    <view class="remarks_ul" id="remarks_ul">  
                        <view class="remarks_lis flex"  v-for="(item, index) of sideShape.images" :key="index">  
                            <view class="remarks_img" @tap="tapImage('sideShape', index)">  
                                <image :src="item" mode="aspectFit"></image>  
                            </view>  
                            <view class="close_img" @tap="deleteShape(index, 1, 'shape')">  
                                <image src="/static/images/close.png" mode="aspectFit"></image>  
                            </view>  
                        </view>  

                        <view  v-if="sideShape.images.length<20"  class="remarks_lis flex"   @tap="uploadShapeImage('shape')">  
                            <view class="remarks_img">  
                                <image src="/static/images/remarks_pic.png" mode="aspectFit" ></image>  
                            </view>  
                        </view>  
                    </view>  
                                         <!-- 视频 -->  
                    <view class="remarks_ul" id="remarks_ul">  
                        <view class="remarks_lis flex"  v-for="(item, index) of sideShape.videos" :key="index">  
                            <view class="remarks_img video_box" @tap="tapVideo(item)">  
                                <!-- <video :src="item" controls></video> -->  
                                <view class="video_img">  
                                    <image src="/static/images/videoOn.png" mode=""></image>  
                                </view>  
                                <view class="close_img" @tap.stop="deleteShape(index, 2, 'shape')">  
                                    <image src="/static/images/close.png" mode="aspectFit"></image>  
                                </view>  
                            </view>  
                        </view>  

                        <view  v-if="sideShape.videos.length<20"  class="remarks_lis flex"   @tap="uploadShapeVideo('shape')">  
                            <view class="remarks_img">  
                                <image src="/static/images/remarks_video.png" mode="aspectFit" ></image>  
                            </view>  
                        </view>  
                    </view>  
                              </view>

            /**  
             *   
             * 上传图片  
             * type: shape , drainage, project  
             */  
            uploadShapeImage(type) {  
                let app = getApp()  
                let that = this;  
                uni.chooseImage({  
                    count: 1,  
                    success: (chooseImageRes) => {  
                        let tempFilePaths = chooseImageRes.tempFilePaths;  
                        // console.log('点击选择图片', chooseImageRes)  

                        uni.showLoading({  
                            title: '正在上传文件..',  
                            mask: true  
                        })  

                        uni.uploadFile({  
                            url: 'http://123.206.82.18...', // 这里省略   
                            filePath: tempFilePaths[0],  
                            name: 'files',  
                            formData: {  
                                'user': 'test'  
                            },  
                            success: (res) => {  
                                // console.log('上传成功', res, res.data);  
                                let info = JSON.parse(res.data)  
                                // console.log('上传成功 data ', info)  
                                let imgUrl = info.data[0].url;  

                                if(type === 'shape'){  
                                    that.sideShape.images.push(imgUrl)  

                                    app.globalData.side.sideShape.images.push(imgUrl)  
                                }else if(type == 'drainage'){  
                                    that.sideDrainage.images.push(imgUrl)  

                                    app.globalData.side.sideDrainage.images.push(imgUrl)  
                                }else if(type === 'project'){  
                                    that.sideProject.images.push(imgUrl)  

                                    app.globalData.side.sideProject.images.push(imgUrl)  
                                }  
                                uni.hideLoading()  
                            },  
                            fail(err){  
                                console.log('上传失败', err)  
                                uni.showToast({  
                                    title: '上传失败',  
                                    icon: 'none',   
                                    mask: true  
                                })  
                            },  
                            complete(){  

                            }  
                        });  
                    }  
                })  
            },  

            /**  
             * 上传 视频  
             * type: shape , drainage, project  
             */  
            uploadShapeVideo(type) {  

                let app = getApp()  

                let that  = this;  
                 uni.chooseVideo({  
                    count: 1,  
                    sourceType: ['camera', 'album'],  
                    success: function (res) {  
                        // console.log('上传视频文件', res)  

                        let src = res.tempFilePath;  
                        // that.sideShape.videos.push(src)  

                        uni.showLoading({  
                            title: '正在上传文件..',  
                            mask: true  
                        })  

                        uni.uploadFile({  
                            url: 'http://123.206.82.18...', // 这里省略   
                            filePath: src,  
                            name: 'files',  
                            formData: {  
                                'user': 'test'  
                            },  
                            success: (res) => {  
                                // console.log('上传成功', res, res.data);  
                                let info = JSON.parse(res.data)  
                                // console.log('上传成功 data ', info)  
                                let imgUrl = info.data[0].url;  

                                if(type === 'shape'){  
                                    that.sideShape.videos.push(imgUrl)  

                                    app.globalData.side.sideShape.videos.push(imgUrl)  
                                }else if(type == 'drainage'){  
                                    that.sideDrainage.videos.push(imgUrl)  

                                    app.globalData.side.sideDrainage.videos.push(imgUrl)  
                                }else if(type === 'project'){  
                                    that.sideProject.videos.push(imgUrl)  

                                    app.globalData.side.sideProject.videos.push(imgUrl)  
                                }  
                                uni.hideLoading()  
                            },  
                            fail(err){  
                                console.log('上传失败', err)  
                                uni.showToast({  
                                    title: '上传失败',  
                                    icon: 'none',   
                                    mask: true  
                                })  
                            },  
                            complete(){  

                            }  
                        })  
                    }  
                })  
            },  

想确认下,这个闪退是内存栈溢出的原因吗?有没有解决方式?

2020-05-29 11:37 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复