EsotericSoftware / spine-runtimes

2D skeletal animation runtimes for Spine.
http://esotericsoftware.com/
Other
4.34k stars 2.89k forks source link

[android]Cannot display on Xiaomi MIX2 #2591

Closed csbz17027 closed 3 weeks ago

csbz17027 commented 1 month ago

I download the spine-android. The spine animation is displayed normally on OnePlus 8 pro. But it is not displayed on XiaoMi MIX2,and click Dress Up will crash. May I ask what I can do to make it run properly? The crash information is as follows: GraphicsJNI A bad length libc A Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 20947 (csoftware.spine), pid 20947 (csoftware.spine) DEBUG A pid: 20947, tid: 20947, name: csoftware.spine >>> com.esotericsoftware.spine <<< DEBUG A #23 pc 0000000000f80756 /data/app/com.esotericsoftware.spine-Jy3ce0E8wbrelf5hQUaMPw==/oat/arm64/base.vdex (com.esotericsoftware.spine.android.SkeletonRenderer.renderToCanvas+106) DEBUG A #29 pc 0000000000f80038 /data/app/com.esotericsoftware.spine-Jy3ce0E8wbrelf5hQUaMPw==/oat/arm64/base.vdex (com.esotericsoftware.spine.android.SkeletonRenderer.renderToBitmap+324) DEBUG A #35 pc 0000000000f9ed46 /data/app/com.esotericsoftware.spine-Jy3ce0E8wbrelf5hQUaMPw==/oat/arm64/base.vdex (com.esotericsoftware.spine.DressUpKt$DressUp$1.invokeSuspend+254) DEBUG A #41 pc 0000000000fc630c /data/app/com.esotericsoftware.spine-Jy3ce0E8wbrelf5hQUaMPw==/oat/arm64/base.vdex (kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith+42) DEBUG A #47 pc 0000000000fc91fe /data/app/com.esotericsoftware.spine-Jy3ce0E8wbrelf5hQUaMPw==/oat/arm64/base.vdex (kotlinx.coroutines.DispatchedTask.run+444) DEBUG A #53 pc 00000000002c36e2 /data/app/com.esotericsoftware.spine-Jy3ce0E8wbrelf5hQUaMPw==/oat/arm64/base.vdex (androidx.compose.ui.platform.AndroidUiDispatcher.performTrampolineDispatch+14) DEBUG A #59 pc 00000000002c35b8 /data/app/com.esotericsoftware.spine-Jy3ce0E8wbrelf5hQUaMPw==/oat/arm64/base.vdex (androidx.compose.ui.platform.AndroidUiDispatcher.access$performTrampolineDispatch) DEBUG A #65 pc 00000000002c3400 /data/app/com.esotericsoftware.spine-Jy3ce0E8wbrelf5hQUaMPw==/oat/arm64/base.vdex (androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame+28) ---------------------------- PROCESS STARTED (21004) for package com.esotericsoftware.spine ---------------------------- ---------------------------- PROCESS ENDED (20947) for package com.esotericsoftware.spine ---------------------------- InputDispatcher E channel '45bf1e4 com.esotericsoftware.spine/com.esotericsoftware.spine.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed! ---------------------------- PROCESS ENDED (21004) for package com.esotericsoftware.spine ----------------------------

badlogic commented 1 month ago

Do the other examples work? They should.

According to the stacktrace, the call to SkeletonRenderer.renderToBitmap() crashes (subsequently in SkeletonRenderer.renderToCanvas()).

The dress-up example iterates through all skins in the skeleton and draws them to individual Bitmap instances. https://github.com/EsotericSoftware/spine-runtimes/blob/4.2/spine-android/app/src/main/java/com/esotericsoftware/spine/DressUp.kt#L137

My guess is that either these Bitmap's is too large for the device, or that there is a driver bug in the Canvas implementatino on that device. If you are able to debug, it would be interesting to know at what skin it crashes (skin.getName() gives you that information in that loop above). We don't have this device and I can also not find it online for purchase where I'm from.

csbz17027 commented 1 month ago

Other examples also did not work.

https://github.com/user-attachments/assets/24a64f09-da1b-467d-bfef-993e8e0b6c2f

From launching the app to clicking on the Simple Animation page, the log output is as follows:

---------------------------- PROCESS STARTED (18544) for package com.esotericsoftware.spine ---------------------------- csoftware.spin W miui_dex2oat: oat file of /data/app/com.esotericsoftware.spine-lyOjmL_TcOBnEPzIghjrVw==/base.apk is not exists Perf I Connecting to perf service. csoftware.spin W Accessing hidden field Landroid/os/Trace;->TRACE_TAG_APP:J (light greylist, reflection) csoftware.spin W Accessing hidden method Landroid/os/Trace;->isTagEnabled(J)Z (light greylist, reflection) csoftware.spin I The ClassLoaderContext is a special shared library. Binder:intercep W type=1400 audit(0.0:7383): avc: denied { getattr } for path="/data/data/com.miui.contentcatcher" dev="sda17" ino=6045732 scontext=u:r:untrusted_app:s0:c182,c261,c512,c768 tcontext=u:object_r:system_app_data_file:s0 tclass=dir permissive=0 ViewContentFactory D initViewContentFetcherClass ViewContentFactory D getInterceptorPackageInfo csoftware.spin W Accessing hidden method Landroid/app/AppGlobals;->getInitialApplication()Landroid/app/Application; (light greylist, linking) ViewContentFactory D getInitialApplication took 2ms ViewContentFactory D packageInfo.packageName: com.miui.catcherpatch Binder:intercep W type=1400 audit(0.0:7384): avc: denied { getattr } for path="/data/data/com.miui.catcherpatch" dev="sda17" ino=6193780 scontext=u:r:untrusted_app:s0:c182,c261,c512,c768 tcontext=u:object_r:system_app_data_file:s0 tclass=dir permissive=0 ViewContentFactory D initViewContentFetcherClass took 15ms ContentCatcher I ViewContentFetcher : ViewContentFetcher ViewContentFactory D createInterceptor took 17ms ContentCatcher I Interceptor : Catcher list invalid for com.esotericsoftware.spine@com.esotericsoftware.spine.MainActivity@113889096 ContentCatcher I Interceptor : Get featureInfo from config pick_mode Looper W Slow Looper: Activity com.esotericsoftware.spine/.MainActivity is 925ms late (wall=174ms running=0ms ClientTransaction{ callbacks=[android.app.servertransaction.LaunchActivityItem] lifecycleRequest=android.app.servertransaction.ResumeActivityItem }) because of 1 msg, msg 1 took 1028ms (h=android.app.ActivityThread$H w=110) csoftware.spin W Class androidx.compose.runtime.snapshots.SnapshotStateMap failed lock verification and will run slower. csoftware.spin W Common causes for lock verification issues are non-optimized dex code csoftware.spin W and incorrect proguard optimizations. csoftware.spin W Class androidx.compose.runtime.snapshots.SnapshotStateList failed lock verification and will run slower. csoftware.spin W Accessing hidden field Landroid/graphics/Insets;->left:I (light greylist, linking) csoftware.spin W Accessing hidden field Landroid/graphics/Insets;->top:I (light greylist, linking) csoftware.spin W Accessing hidden field Landroid/graphics/Insets;->right:I (light greylist, linking) csoftware.spin W Accessing hidden field Landroid/graphics/Insets;->bottom:I (light greylist, linking) csoftware.spin W Accessing hidden field Landroid/view/WindowInsets;->CONSUMED:Landroid/view/WindowInsets; (light greylist, reflection) csoftware.spin W Accessing hidden method Landroid/view/View;->getViewRootImpl()Landroid/view/ViewRootImpl; (light greylist, reflection) csoftware.spin W Accessing hidden field Landroid/view/View$AttachInfo;->mVisibleInsets:Landroid/graphics/Rect; (light greylist, reflection) csoftware.spin W Accessing hidden field Landroid/view/ViewRootImpl;->mAttachInfo:Landroid/view/View$AttachInfo; (light greylist, reflection) Adreno I QUALCOMM build : 2c6a1c7, I1490fecf6e Build Date : 02/04/19 OpenGL ES Shader Compiler Version: EV031.25.03.02 Local Branch : Remote Branch : Remote Branch : Reconstruct Branch : Adreno I Build Config : S L 6.0.7 AArch64 vndksupport D Loading /vendor/lib64/hw/gralloc.msm8998.so from current namespace instead of sphal namespace. Adreno I PFP: 0x005ff112, ME: 0x005ff066 ConfigStore I android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0 ConfigStore I android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0 OpenGLRenderer I Initialized EGL, version 1.4 OpenGLRenderer D Swap behavior 2 csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->create(Ljava/lang/String;Landroid/view/View;)Landroid/view/RenderNode; (light greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->getScaleX()F (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/DisplayListCanvas;->drawRenderNode(Landroid/view/RenderNode;)V (light greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->getScaleX()F (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->getAlpha()F (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->getCameraDistance()F (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->getClipToOutline()Z (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->getElevation()F (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->isValid()Z (light greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->getInverseMatrix(Landroid/graphics/Matrix;)V (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->getMatrix(Landroid/graphics/Matrix;)V (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->getPivotX()F (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->getPivotY()F (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->getRotationX()F (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->getRotationY()F (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->getRotation()F (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->getScaleX()F (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->getScaleY()F (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->getTranslationX()F (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->getTranslationY()F (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->hasOverlappingRendering()Z (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->offsetLeftAndRight(I)Z (light greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->offsetTopAndBottom(I)Z (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->start(II)Landroid/view/DisplayListCanvas; (light greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->end(Landroid/view/DisplayListCanvas;)V (light greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->setAlpha(F)Z (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->setCameraDistance(F)Z (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->setClipToBounds(Z)Z (light greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->setClipToOutline(Z)Z (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->setLayerType(I)Z (dark greylist, linking) chatty I uid=11462(com.esotericsoftware.spine) identical 1 line csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->setLayerType(I)Z (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->setElevation(F)Z (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->setHasOverlappingRendering(Z)Z (light greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->setOutline(Landroid/graphics/Outline;)Z (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->setPivotX(F)Z (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->setPivotY(F)Z (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->setLeftTopRightBottom(IIII)Z (light greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->setRotationX(F)Z (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->setRotationY(F)Z (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->setRotation(F)Z (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->setScaleX(F)Z (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->setScaleY(F)Z (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->setTranslationX(F)Z (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->setTranslationY(F)Z (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/view/RenderNode;->getScaleX()F (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/text/SpannableStringInternal;->length()I (light greylist, linking) csoftware.spin W Accessing hidden method Landroid/graphics/Canvas;->drawPatch(Landroid/graphics/NinePatch;Landroid/graphics/Rect;Landroid/graphics/Paint;)V (dark greylist, linking) csoftware.spin W Accessing hidden method Landroid/graphics/Canvas;->drawPatch(Landroid/graphics/NinePatch;Landroid/graphics/RectF;Landroid/graphics/Paint;)V (dark greylist, linking) View W requestLayout() improperly called by androidx.compose.ui.platform.ViewLayerContainer{e7ce47c V.E...... ......ID 0,0-0,0} during layout: running second layout pass Choreographer I Skipped 52 frames! The application may be doing too much work on its main thread. vndksupport D Loading /vendor/lib64/hw/android.hardware.graphics.mapper@2.0-impl.so from current namespace instead of sphal namespace. vndksupport D Loading /vendor/lib64/hw/gralloc.msm8998.so from current namespace instead of sphal namespace. OpenGLRenderer I Davey! duration=960ms; Flags=0, IntendedVsync=1463139454552, Vsync=1464006121184, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=1464023373294, AnimationStart=1464023510638, PerformTraversalsStart=1464034830951, DrawStart=1464035533138, SyncQueued=1464061572253, SyncStart=1464061693919, IssueDrawCommandsStart=1464061877878, SwapBuffers=1464098486211, FrameCompleted=1464100094701, DequeueBufferDuration=204000, QueueBufferDuration=387000, Looper W Slow Looper: doFrame is 883ms late because of 4 msg, msg 1 took 959ms (late=190ms h=android.view.Choreographer$FrameHandler c=android.view.Choreographer$FrameDisplayEventReceiver) csoftware.spin W Accessing hidden method Landroid/os/Trace;->asyncTraceBegin(JLjava/lang/String;I)V (light greylist, reflection) csoftware.spin W Accessing hidden method Landroid/os/Trace;->asyncTraceEnd(JLjava/lang/String;I)V (light greylist, reflection) csoftware.spin W Accessing hidden method Landroid/os/Trace;->traceCounter(JLjava/lang/String;I)V (light greylist, reflection) csoftware.spin I Compiler allocated 4MB to compile com.badlogic.gdx.utils.JsonValue com.badlogic.gdx.utils.JsonReader.parse(char[], int, int) csoftware.spin I Compiler allocated 4MB to compile void com.esotericsoftware.spine.SkeletonJson.readAnimation(com.badlogic.gdx.utils.JsonValue, java.lang.String, com.esotericsoftware.spine.SkeletonData) ProfileInstaller D Installing profile for com.esotericsoftware.spine csoftware.spin I ProcessProfilingInfo new_methods=11160 is saved saved_to_disk=1 resolve_classes_delay=8000

csbz17027 commented 1 month ago

The equipment information of XiaoMi MIX2 is as follows: android version is 9 android api level is 28 CPU is Qualcomm Snapdragon 835 2.46 GHz RAM is 8GB

badlogic commented 3 weeks ago

Hm, we don't even get a crash in the second example, just a blank screen? The log doesn't give me any information what might be going wrong.

We are talking about this phone, right? https://www.gsmarena.com/xiaomi_mi_mix_2-8529.php

We do not do anything fancy, we use Canvas.drawVertices() to render textured triangle meshes onto a canvas. That's standard Android API stuff.

My only guess is that the graphics stack implementation for that device has a bug. What Android variant is this using? I see Android version 9, API level 28. But I'm interested in the concrete variant. Is it a custom ROM? Is it MIUI?

I'm afraid without owning such a device I will not be able to fix this.

csbz17027 commented 3 weeks ago

Hm, we don't even get a crash in the second example, just a blank screen? The log doesn't give me any information what might be going wrong.

We are talking about this phone, right? https://www.gsmarena.com/xiaomi_mi_mix_2-8529.php

We do not do anything fancy, we use Canvas.drawVertices() to render textured triangle meshes onto a canvas. That's standard Android API stuff.

My only guess is that the graphics stack implementation for that device has a bug. What Android variant is this using? I see Android version 9, API level 28. But I'm interested in the concrete variant. Is it a custom ROM? Is it MIUI?

I'm afraid without owning such a device I will not be able to fix this.

Thank you for your reply. It's the phone in your link.The ROM of this phone is MIUI,the MIUI version is 12.0.1. But I have temporarily given up on this issue,it's taking up too much of my time. Thank you again for your patient reply.

badlogic commented 3 weeks ago

Sorry for the trouble :( The issue is likely a broken Skia version, that doesn't implement Canvas.drawMesh() correctly. This is an issue shared by some other Android variants, and I'm afraid there's not much we can do on our end to fix this. Thank you for reporting the issue!