GithubHelp home page GithubHelp logo

yuyashuai / frameanimation Goto Github PK

View Code? Open in Web Editor NEW
305.0 305.0 45.0 92.79 MB

High-Performance Frame Animation Library For Android

License: Apache License 2.0

Java 3.56% Kotlin 96.44%
android animation frameanimation surfaceview textureview

frameanimation's Issues

设置模式后不会自动重复播放

animationView.playAnimationFromAssets("login");
animationView.setRepeatMode(FrameAnimation.RepeatMode.INFINITE);
animationView.setSupportInBitmap(true);
animationView.freezeLastFrame(true);

can't start animation after release这个错误该怎么解决frameanimation:2.3.1

03-23 15:04:10.792 18340 18340 E AndroidRuntime: java.lang.IllegalStateException: can't start animation after release
03-23 15:04:10.793 18340 18340 E uncaughtException: can't start animation after releasecom.yuyashuai.frameanimation.io.BitmapPoolImpl.start(BitmapPoolImpl.kt:92)
03-23 15:04:10.793 18340 18340 E uncaughtException: com.yuyashuai.frameanimation.FrameAnimation.playAnimation(FrameAnimation.kt:220)
03-23 15:04:10.793 18340 18340 E uncaughtException: com.yuyashuai.frameanimation.FrameAnimationView.playAnimation(Unknown Source:7)
03-23 15:04:10.793 18340 18340 E uncaughtException: com.qingshu520.chat.modules.chatroom.widget.RoomNobleInView.setAnimationData(RoomNobleInView.java:324)
03-23 15:04:10.793 18340 18340 E uncaughtException: com.qingshu520.chat.modules.chatroom.widget.RoomNobleInView.access$400(RoomNobleInView.java:44)
03-23 15:04:10.793 18340 18340 E uncaughtException: com.qingshu520.chat.modules.chatroom.widget.RoomNobleInView$2.downloadSuccess(RoomNobleInView.java:301)
03-23 15:04:10.793 18340 18340 E uncaughtException: com.qingshu520.chat.modules.chatroom.helper.ZipHelper$1$1.onPostExecute(ZipHelper.java:107)
03-23 15:04:10.793 18340 18340 E uncaughtException: com.qingshu520.chat.modules.chatroom.helper.ZipHelper$1$1.onPostExecute(ZipHelper.java:93)
03-23 15:04:10.793 18340 18340 E uncaughtException: android.os.AsyncTask.finish(AsyncTask.java:695)
03-23 15:04:10.793 18340 18340 E uncaughtException: android.os.AsyncTask.access$600(AsyncTask.java:180)
03-23 15:04:10.793 18340 18340 E uncaughtException: android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
03-23 15:04:10.793 18340 18340 E uncaughtException: android.os.Handler.dispatchMessage(Handler.java:106)
03-23 15:04:10.793 18340 18340 E uncaughtException: android.os.Looper.loop(Looper.java:224)
03-23 15:04:10.793 18340 18340 E uncaughtException: android.app.ActivityThread.main(ActivityThread.java:7060)
03-23 15:04:10.793 18340 18340 E uncaughtException: java.lang.reflect.Method.invoke(Native Method)
03-23 15:04:10.793 18340 18340 E uncaughtException: com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:536)
03-23 15:04:10.793 18340 18340 E uncaughtException: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:928)

frameanimation:2.3.1 新bug

java.lang.NullPointerException
03-20 14:59:51.700 9058 17550 E AndroidRuntime: at java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1019)
03-20 14:59:51.700 9058 17550 E AndroidRuntime: at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1014)
03-20 14:59:51.700 9058 17550 E AndroidRuntime: at com.yuyashuai.frameanimation.io.DefaultBitmapPool$decodeBitmap$$inlined$repeat$lambda$1.run(DefaultBitmapPool.kt:138)
03-20 14:59:51.700 9058 17550 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
03-20 14:59:51.700 9058 17550 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)

捕获到Native崩溃

我这边在release版本被用户调用时,bugly抓到了native的崩溃,log如下:

1 #00 pc 0001a078 /system/lib/libc.so (memset+60) [armeabi-v7a]

#1 pc 0010f135 /system/lib/libhwui.so (SkCanvas::writePixels(SkImageInfo const&, void const*, unsigned int, int, int)+72) [armeabi-v7a]
#2 pc 00372843 /system/lib/libhwui.so [armeabi-v7a]
#3 pc 0036ac37 /system/lib/libhwui.so [armeabi-v7a]
#4 pc 0033dbf5 /system/lib/libhwui.so (SkCanvas::internalDrawPaint(SkPaint const&)+224) [armeabi-v7a]
#5 pc 00370bd9 /system/lib/libhwui.so (SkCanvas::drawColor(unsigned int, SkBlendMode)+40) [armeabi-v7a]
#6 pc 003f3d61 /system/framework/arm/boot-framework.oat [armeabi]
8 java:
9 android.graphics.BaseCanvas.drawColor(BaseCanvas.java:243)
10 android.graphics.Canvas.drawColor(Canvas.java:1631)
11 g.h.a.f.c.clear(TextureBitmapDrawer.kt:2)
12 g.h.a.d.invoke(FrameAnimation.kt:50)
13 g.h.a.d.invoke(FrameAnimation.kt:1)
14 h.x.a.run(Thread.kt:1)

一直在gc

D/dalvikvm: GC_FOR_ALLOC freed 7108K, 22% free 29340K/37516K, paused 27ms, total 27ms
一直在跑gc,但是没有内存泄漏。

请教:使用FrameAnimation引发的FileMAP:OOM

你好,使用FrameAnimation有一些问题想要请教下您,可能加个qq啊,方便沟通

当前遇到的问题:
出现了FileMAP:OOM
代码中写:
1、framAnimation与OnStop绑定(动画暂停),是不是不合适呢
2、一个frameAnimation控件,不断加载不同的Asset文件

这种写法是不是不太对

烦请您加一个qq(2857035110),感谢

java.lang.InterruptedException导致动画提前结束

    dispatcherThread = thread(start = true, name = "FA-DispatcherThread") {
        try {
            while (state == WORKING && !Thread.currentThread().isInterrupted) {
                decodeBitmap()
            }
        } catch (e: InterruptedException) {
            Log.e("test", "BitmapPoolImp  error=" + e.toString());
            //java.lang.InterruptedException这里会有异常,导致动画提前结束
            Thread.currentThread().interrupt()
        }
        clearAndStop()
    }

第一帧

如何让没开始之前就出现第一帧,播放完之后停留在最后一帧?谢谢

bug

再小米手机上运行,运动速度非常快,但是在其他手机型上不会,查看了开发者动画的速度并没有调整过

设置播放时间的问题!

我首先在6.0的小米手机上试了下效果,挺好的, 但是播放时间有点慢, 我修改成了setFrameInterval(50,30,10)之后 然后播放一遍就卡死了, log控制台总是不停地打印这句话 如下图

open
然后我试着把SurfaceViewAnimation类中的 private int mFrameInterval = 100; 这个值给改为 50 ,30 10 也是不行, 控制台同样打印这句话
还有我用Android 4.4的手机跑了一下demo 代码没有任何改动 直接就打印这个log了 界面卡死了 不动弹了! 希望博主看看这个问题 谢谢。

使用sd卡片中的图片播放,解析文件过程中出现死循环?

调用方法animationView1.playAnimationFromFile(“/storage/emulated/0/testimage/image1/”);
然后就报下面错误了。

07-30 13:45:16.031 2430-2430/AndroidRuntime: FATAL EXCEPTION: main
Process: com.**.test, PID: 2430
java.lang.StackOverflowError: stack size 8MB
at com.yuyashuai.frameanimation.FrameAnimationUtil.getPathList(FrameAnimationUtil.kt)
at com.yuyashuai.frameanimation.FrameAnimationUtil.getPathList(FrameAnimationUtil.kt:76)
at com.yuyashuai.frameanimation.FrameAnimationUtil.getPathList(FrameAnimationUtil.kt:76)
at com.yuyashuai.frameanimation.FrameAnimationUtil.getPathList(FrameAnimationUtil.kt:76)
at com.yuyashuai.frameanimation.FrameAnimationUtil.getPathList(FrameAnimationUtil.kt:76)

动画播放时间长一点的话 会报native crash

动画播放时间长一点的话 会报native crash,下面是log,播放时长不一定,有的时候很长才crash有的时候一下就crash了,下面是log:
backtrace:
#00 pc 000000000007eec4 /dev/ashmem/dalvik-jit-code-cache (deleted) (java.util.concurrent.locks.AbstractQueuedSynchronizer.unparkSuccessor+68)
#1 pc 00000000000773b0 /dev/ashmem/dalvik-jit-code-cache (deleted) (java.util.concurrent.locks.AbstractQueuedSynchronizer.release+128)
#2 pc 000000000007b34c /dev/ashmem/dalvik-jit-code-cache (deleted) (java.util.concurrent.locks.ReentrantLock.unlock+60)
#3 pc 00000000000857d4 /dev/ashmem/dalvik-jit-code-cache (deleted) (java.util.concurrent.LinkedBlockingQueue.signalNotEmpty+164)
#4 pc 0000000000080124 /dev/ashmem/dalvik-jit-code-cache (deleted) (java.util.concurrent.LinkedBlockingQueue.offer+436)
#5 pc 0000000000081730 /dev/ashmem/dalvik-jit-code-cache (deleted) (com.yuyashuai.frameanimation.io.BitmapPoolImpl.recycle+192)
#6 pc 0000000000554988 /system/lib64/libart.so (art_quick_invoke_stub+584)
#7 pc 00000000000cf6c8 /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
#8 pc 000000000027f2b4 /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
#9 pc 00000000002792bc /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+968)
#10 pc 000000000052568c /system/lib64/libart.so (MterpInvokeInterface+1392)
#11 pc 0000000000547214 /system/lib64/libart.so (ExecuteMterpImpl+14740)
#12 pc 0000000001c7f4c4 /data/app/com.xxx.profile-iEw6z-i4Q-Hxrbwo9rzKww==/oat/arm64/base.vdex (com.yuyashuai.frameanimation.FrameAnimation$draw$1.invoke+514)
#13 pc 0000000000252fc0 /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2118865428+488)
#14 pc 0000000000258ab4 /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
#15 pc 00000000002792a0 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+940)
#16 pc 0000000000524710 /system/lib64/libart.so (MterpInvokeVirtual+588)
#17 pc 0000000000547014 /system/lib64/libart.so (ExecuteMterpImpl+14228)
#18 pc 0000000001c7f2a0 /data/app/com.xxx.profile-iEw6z-i4Q-Hxrbwo9rzKww==/oat/arm64/base.vdex (com.yuyashuai.frameanimation.FrameAnimation$draw$1.invoke)
#19 pc 0000000000252fc0 /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2118865428+488)
#20 pc 0000000000258ab4 /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
#21 pc 00000000002792a0 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+940)
#22 pc 000000000052568c /system/lib64/libart.so (MterpInvokeInterface+1392)
#23 pc 0000000000547214 /system/lib64/libart.so (ExecuteMterpImpl+14740)
#24 pc 0000000001d28d14 /data/app/com.xxx.profile-iEw6z-i4Q-Hxrbwo9rzKww==/oat/arm64/base.vdex (kotlin.concurrent.ThreadsKt$thread$thread$1.run+4)
#25 pc 0000000000252fc0 /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2118865428+488)
#26 pc 0000000000514fa4 /system/lib64/libart.so (artQuickToInterpreterBridge+1020)
#27 pc 000000000055dafc /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
#28 pc 0000000000554988 /system/lib64/libart.so (art_quick_invoke_stub+584)
#29 pc 00000000000cf6c8 /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
#30 pc 000000000045c840 /system/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
#31 pc 000000000045d8fc /system/lib64/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue*)+424)
#32 pc 0000000000488798 /system/lib64/libart.so (art::Thread::CreateCallback(void*)+1120)
#33 pc 00000000000819b4 /system/lib64/libc.so (__pthread_start(void*)+36)
#34 pc 0000000000023478 /system/lib64/libc.so (__start_thread+68)

内存泄漏问题。

蛮不错的,赞!
但是我看到里面有很多内部类和匿名内部类,有没有考虑内存泄漏的问题?

帧动画在有时候不会展示

simpleDraweeView.setFrameInterval(60);
simpleDraweeView.setScaleType(FrameAnimation.ScaleType.FIT_XY);

if(simpleDraweeView.isPlaying()) {
     simpleDraweeView.stopAnimation();
 }

simpleDraweeView.playAnimationFromAssets("gift_level_5");

当我一直尝试重复播放一段帧动画时,有很大概率曝出以下异常并且动画不显示。也就是以上一段代码。

java.lang.InterruptedException
     at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2034)
     at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2068)
     at java.util.concurrent.LinkedBlockingDeque.takeFirst(LinkedBlockingDeque.java:492)
     at java.util.concurrent.LinkedBlockingDeque.take(LinkedBlockingDeque.java:680)
     at com.yuyashuai.frameanimation.io.DefaultBitmapPool.take(DefaultBitmapPool.kt:203)
     at com.yuyashuai.frameanimation.FrameAnimation$draw$1.invoke(FrameAnimation.kt:245)
     at com.yuyashuai.frameanimation.FrameAnimation$draw$1.invoke(FrameAnimation.kt:24)
     at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)
 java.util.concurrent.RejectedExecutionException: Task com.yuyashuai.frameanimation.io.DefaultBitmapPool$decodeBitmap$$inlined$repeat$lambda$1@ea3110c rejected from java.util.concurrent.ThreadPoolExecutor@5e81a55[Shutting down, pool size = 1, active threads = 1, queued tasks = 0, completed tasks = 0]
     at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2078)
     at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:843)
     at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1389)
     at com.yuyashuai.frameanimation.io.DefaultBitmapPool.decodeBitmap(DefaultBitmapPool.kt:121)
     at com.yuyashuai.frameanimation.io.DefaultBitmapPool.access$decodeBitmap(DefaultBitmapPool.kt:13)
     at com.yuyashuai.frameanimation.io.DefaultBitmapPool$start$2.run(DefaultBitmapPool.kt:86)
     at java.lang.Thread.run(Thread.java:764)
 java.util.concurrent.RejectedExecutionException: Task com.yuyashuai.frameanimation.io.DefaultBitmapPool$decodeBitmap$$inlined$repeat$lambda$1@2f631f8 rejected from java.util.concurrent.ThreadPoolExecutor@5e81a55[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 1]
     at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2078)
     at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:843)
     at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1389)
     at com.yuyashuai.frameanimation.io.DefaultBitmapPool.decodeBitmap(DefaultBitmapPool.kt:121)
     at com.yuyashuai.frameanimation.io.DefaultBitmapPool.access$decodeBitmap(DefaultBitmapPool.kt:13)
     at com.yuyashuai.frameanimation.io.DefaultBitmapPool$start$2.run(DefaultBitmapPool.kt:86)
     at java.lang.Thread.run(Thread.java:764)
 java.util.concurrent.RejectedExecutionException: Task com.yuyashuai.frameanimation.io.DefaultBitmapPool$decodeBitmap$$inlined$repeat$lambda$1@7b0fec2 rejected from java.util.concurrent.ThreadPoolExecutor@5e81a55[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 1]
     at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2078)
     at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:843)
     at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1389)
     at com.yuyashuai.frameanimation.io.DefaultBitmapPool.decodeBitmap(DefaultBitmapPool.kt:121)
     at com.yuyashuai.frameanimation.io.DefaultBitmapPool.access$decodeBitmap(DefaultBitmapPool.kt:13)
     at com.yuyashuai.frameanimation.io.DefaultBitmapPool$start$2.run(DefaultBitmapPool.kt:86)
     at java.lang.Thread.run(Thread.java:764)
 java.util.concurrent.RejectedExecutionException: Task com.yuyashuai.frameanimation.io.DefaultBitmapPool$decodeBitmap$$inlined$repeat$lambda$1@f794810 rejected from java.util.concurrent.ThreadPoolExecutor@5e81a55[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 1]
     at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2078)
     at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:843)
     at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1389)
     at com.yuyashuai.frameanimation.io.DefaultBitmapPool.decodeBitmap(DefaultBitmapPool.kt:121)
     at com.yuyashuai.frameanimation.io.DefaultBitmapPool.access$decodeBitmap(DefaultBitmapPool.kt:13)
     at com.yuyashuai.frameanimation.io.DefaultBitmapPool$start$2.run(DefaultBitmapPool.kt:86)
     at java.lang.Thread.run(Thread.java:764)
 java.lang.InterruptedException
     at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1326)
     at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:232)
     at com.yuyashuai.frameanimation.io.DefaultBitmapPool.decodeBitmap(DefaultBitmapPool.kt:150)
     at com.yuyashuai.frameanimation.io.DefaultBitmapPool.access$decodeBitmap(DefaultBitmapPool.kt:13)
     at com.yuyashuai.frameanimation.io.DefaultBitmapPool$start$2.run(DefaultBitmapPool.kt:86)
     at java.lang.Thread.run(Thread.java:764)
 java.lang.InterruptedException
     at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1022)
     at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1328)
     at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:232)
     at com.yuyashuai.frameanimation.io.DefaultBitmapPool.decodeBitmap(DefaultBitmapPool.kt:150)
     at com.yuyashuai.frameanimation.io.DefaultBitmapPool.access$decodeBitmap(DefaultBitmapPool.kt:13)
     at com.yuyashuai.frameanimation.io.DefaultBitmapPool$start$2.run(DefaultBitmapPool.kt:86)
     at java.lang.Thread.run(Thread.java:764)
 java.lang.InterruptedException
     at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2034)
     at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2068)
     at java.util.concurrent.LinkedBlockingDeque.takeFirst(LinkedBlockingDeque.java:492)
     at java.util.concurrent.LinkedBlockingDeque.take(LinkedBlockingDeque.java:680)
     at com.yuyashuai.frameanimation.io.DefaultBitmapPool.take(DefaultBitmapPool.kt:203)
     at com.yuyashuai.frameanimation.FrameAnimation$draw$1.invoke(FrameAnimation.kt:245)
     at com.yuyashuai.frameanimation.FrameAnimation$draw$1.invoke(FrameAnimation.kt:24)
     at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)

内存泄露

您好,您的开源框架是少数几个能在机顶盒上做复杂序列帧动画不卡的。
现在我遇到一个比较严重的内存泄露问题,我再一个页面中,不断的清除、新增 多个 FrameAnimation控件播放多个序列帧,平均1小时左右,内存占用会在1分钟内突然持续大量增长,直到最终由decodeBitmap()触发OOM。OOM页面闪退后,泄露内存依然无法释放

#125006 java.lang.OutOfMemoryError
pthread_create (1040KB stack) failed: Try again
com.yuyashuai.frameanimation.io.BitmapPoolImpl.void decodeBitmap()(BitmapPoolImpl.java:154)

关于动画执行过程,home键退出再次进入时,报错

11-21 12:50:54.120 4760-4832/com.yuyashuai.surfaceviewanimation E/SurfaceHolder: Exception locking surface
                                                                                 java.lang.IllegalArgumentException: Surface was already locked
                                                                                     at android.view.Surface.lockCanvas(Surface.java:262)
                                                                                     at android.view.SurfaceView$4.internalLockCanvas(SurfaceView.java:826)
                                                                                     at android.view.SurfaceView$4.lockCanvas(SurfaceView.java:794)
                                                                                     at com.yuyashuai.surfaceanimation.SurfaceViewAnimation$MyCallBack.clearSurface(SurfaceViewAnimation.java:324)
                                                                                     at com.yuyashuai.surfaceanimation.SurfaceViewAnimation$MyCallBack.drawBitmap(SurfaceViewAnimation.java:307)
                                                                                     at com.yuyashuai.surfaceanimation.SurfaceViewAnimation$MyCallBack.access$1600(SurfaceViewAnimation.java:261)
                                                                                     at com.yuyashuai.surfaceanimation.SurfaceViewAnimation$MyCallBack$1.run(SurfaceViewAnimation.java:345)
11-21 12:50:54.220 4760-4832/com.yuyashuai.surfaceviewanimation E/AndroidRuntime: FATAL EXCEPTION: Thread-3543
                                                                                  Process: com.yuyashuai.surfaceviewanimation, PID: 4760
                                                                                  java.lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.Canvas.drawColor(int, android.graphics.PorterDuff$Mode)' on a null object reference
                                                                                      at com.yuyashuai.surfaceanimation.SurfaceViewAnimation$MyCallBack.clearSurface(SurfaceViewAnimation.java:326)
                                                                                      at com.yuyashuai.surfaceanimation.SurfaceViewAnimation$MyCallBack.drawBitmap(SurfaceViewAnimation.java:307)
                                                                                      at com.yuyashuai.surfaceanimation.SurfaceViewAnimation$MyCallBack.access$1600(SurfaceViewAnimation.java:261)
                                                                                      at com.yuyashuai.surfaceanimation.SurfaceViewAnimation$MyCallBack$1.run(SurfaceViewAnimation.java:345)

bug

传了文件夹的路径,没有判断文件夹里是否含有其他非图片文件

stop anim会在最后一帧之前调用

会导致sleep的时候, 这个线程被杀,然后报异常

W/System.err: java.lang.InterruptedException
W/System.err: at java.lang.Thread.sleep(Native Method)
at java.lang.Thread.sleep(Thread.java:1031)
at java.lang.Thread.sleep(Thread.java:985)
at com.yuyashuai.silkyanimation.SilkyAnimation$MyCallBack$1.run(SilkyAnimation.java:822)

Bug

Tecent-Bugly:上报的日志,请帮忙看看修复一下,谢谢大佬
1 #00 pc 001ea248 /system/lib/libskia.so (SkGpuDevice::~SkGpuDevice()+75) [armeabi-v7a]

#1 pc 001ebcb0 /system/lib/libskia.so (SkARGB32_Shader_Blitter::blitRect(int, int, int, int)+1936) [armeabi-v7a]
3 java:
4 android.graphics.Canvas.drawBitmap(Canvas.java:1500)
5 com.yuyashuai.frameanimation.drawer.TextureBitmapDrawer.draw(TextureBitmapDrawer.kt:22)
6 com.yuyashuai.frameanimation.FrameAnimation$draw$1.invoke(FrameAnimation.kt:254)
7 com.yuyashuai.frameanimation.FrameAnimation$draw$1.invoke(FrameAnimation.kt:25)
8 kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)

新建一个Demo工程,引入项目出错

报错如下:

ERROR: Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
	is also present at [androidx.core:core:1.0.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
	Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-19:19 to override.

尝试按照建议也无法解决,貌似是AndroidX包的引入冲突问题

动画提前结束,Surface报错

机型:Google Pixel一代
系统:8.1.0
前置条件:设置播放模式FrameAnimation.RepeatMode.ONCE
表现:动画提前结束,出现surface报错。
出错日志:

2019-07-10 18:24:32.844 2476-2669/com.yuyashuai.silkyanimation I/System.out: progress:0.9502488  frameIndex:191  totalFrames:201
2019-07-10 18:24:32.888 2476-2669/com.yuyashuai.silkyanimation I/System.out: progress:0.95522386  frameIndex:192  totalFrames:201
2019-07-10 18:24:32.933 2476-2669/com.yuyashuai.silkyanimation I/System.out: progress:0.960199  frameIndex:193  totalFrames:201
2019-07-10 18:24:32.976 2476-2669/com.yuyashuai.silkyanimation I/System.out: progress:0.96517414  frameIndex:194  totalFrames:201
2019-07-10 18:24:33.004 2476-2476/com.yuyashuai.silkyanimation E/Surface: Surface::lock failed, already locked
2019-07-10 18:24:33.017 2476-2669/com.yuyashuai.silkyanimation I/System.out: progress:0.0049751243  frameIndex:1  totalFrames:201

Dialog帧动画布局位置,show和dismiss瞬间,会有黑块

Dialog帧动画布局位置,show和dismiss瞬间,会有黑块

// show代码块
reward_badge.run {
autoRelease = false
setScaleType(FrameAnimation.ScaleType.FIT_XY)
setFrameInterval(135)
setRepeatMode(FrameAnimation.RepeatMode.INFINITE)
playAnimationFromAssets("anim/live_reward")
}

// dismiss代码块
reward_badge.stopAnimationSafely()

比较占内存

初次使用体验确实很好 。但我关闭界面在 反复多次进入界面后播放动画 使用内存会一路累加 。。直至APP卡死(页面关闭时onDestroy 里有调用stopAnimation)

decodeStream很慢.

decodeStream很慢.每张都在40到60ms 导致播放帧动画的时候报错

get bitmap in position: 5 is null ,animation was forced to stop

动画线程就被关掉了.

有什么解决办法吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.