【问题标题】:Wallpaper crashes with error - queueBuffer: error queuing buffer to SurfaceTexture壁纸因错误而崩溃 - queueBuffer:错误将缓冲区排队到 SurfaceTexture
【发布时间】:2012-06-07 19:19:39
【问题描述】:

动态壁纸崩溃,代码如下

public void render(){


    Canvas canvas = null;
    try{

        canvas = this._surfaceHolder.lockCanvas(null);
        synchronized (this._surfaceHolder) {
            this.onDraw(canvas);
        }

    }catch(Exception e){ Log.w("Surface holder ", e.toString());}

    finally{
        if(canvas != null){
            this._surfaceHolder.unlockCanvasAndPost(canvas);
        }
    }   
}

protected void onDraw(Canvas canvas) {
    this.renderBackGround(canvas);
    for (Renderable renderable : this._fishes) {
        renderable.render(canvas);
    }
};

崩溃并出现以下错误

06-07 19:49:09.143: E/SurfaceTextureClient(13629): queueBuffer: 到 SurfaceTexture 的错误队列缓冲区,-19

06-07 19:49:09.143:E/SurfaceTextureClient(13629): queueBuffer (handle=0x1c1b30) 失败(没有这样的设备) 06-07 19:49:09.143: W/dalvikvm(13629): threadid=11: 线程以未捕获的异常退出 (group=0x40c671f8) 06-07 19:49:09.143: E/AndroidRuntime(13629): 致命异常:Thread-692

06-07 19:49:09.143: E/AndroidRuntime(13629): java.lang.IllegalArgumentException

06-07 19:49:09.143: E/AndroidRuntime(13629): at android.view.Surface.unlockCanvasAndPost(Native Method)

06-07 19:49:09.143:E/AndroidRuntime(13629):在 com.android.internal.view.BaseSurfaceHolder.unlockCanvasAndPost(BaseSurfaceHolder.java:215)

提前致谢

【问题讨论】:

  • 这个问题你解决了吗?我有同样的问题,互联网上似乎没有记录在案的解决方案。

标签: android canvas live-wallpaper surfaceholder


【解决方案1】:

这通常发生在您在动态壁纸选择器中旋转设备时。我找到的唯一解决方案是捕获 IllegalArgumentException 并忽略它。

if (canvas != null) {
    try {
        holder.unlockCanvasAndPost(canvas);
    } catch (IllegalArgumentException e) {
        // Ignore weird bug when rotating in live wallpaper picker
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-04
    • 1970-01-01
    • 1970-01-01
    • 2017-09-28
    • 2017-08-21
    • 2014-01-20
    相关资源
    最近更新 更多