Android集成闪退,代码直接拷贝自官方demo

0 投票
最新提问 10月 20, 2017 用户: liuchao5year (120 分)
修改于 10月 20, 2017 用户:liuchao5year
A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
                                             java.lang.Throwable: Explicit termination method 'close' not called
                                                 at dalvik.system.CloseGuard.open(CloseGuard.java:184)
                                                 at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:179)
                                                 at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:168)
                                                 at android.content.res.AssetManager.openAssetFd(Native Method)
                                                 at android.content.res.AssetManager.openFd(AssetManager.java:361)
                                                 at cn.easyar.engine.VideoPlayer.prepare(VideoPlayer.java:49)
                                                 at cn.easyar.VideoPlayer.open(Native Method)
                                                 at com.kindergarten.msmk.ui.ar.ARVideo.openVideoFile(ARVideo.java:45)
                                                 at com.kindergarten.msmk.ui.ar.HelloAR.render(HelloAR.java:257)
                                                 at com.kindergarten.msmk.ui.ar.GLView$1.onDrawFrame(GLView.java:52)
                                                 at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1579)
                                                 at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1285)

1个回答

0 投票
最新回答 10月 20, 2017 用户: easyar0807 (930 分)

你好,从你的log可以看出,内存泄露

1)第一种可能就是,你的代码中,有IO操作,一定要记得释放,调用close方法,关闭。

(2)第二种可能,不是IO异常,而是你在主线程中使用了网络请求,

发表于 10月 20, 2017 用户: liuchao5year (120 分)
修改于 10月 20, 2017 用户:liuchao5year
报错的地方就是播放器打开assets下视频文件的地方,player.open(path, StorageType.Assets, new FunctorOfVoidFromVideoStatus() {
            @Override
            public void invoke(int status) {
                setVideoStatus(status);
            }
        });
应该是这块资源未及时释放,你们的播放器不应该自动释放资源吗
欢迎来到 EasyAR Q&A ,有什么不懂的可以尽管在这里提问,你将会收到社区其他成员的回答。
...