Adobe-Runtime-Support icon indicating copy to clipboard operation
Adobe-Runtime-Support copied to clipboard

Crash on android: Fatal Exception: java.lang.UnsatisfiedLinkError

Open shaymolho opened this issue 3 years ago • 11 comments

Hi, I'm using Air 33.1.1.406 See the following crash:

Fatal Exception: java.lang.UnsatisfiedLinkError
Native method not found: com.adobe.flashruntime.air.VideoViewAIR.nativeSetSurfaceSize:(JII)V
com.adobe.flashruntime.air.VideoViewAIR.nativeSetSurfaceSize (VideoViewAIR.java)
com.adobe.flashruntime.air.VideoViewAIR.access$000 (VideoViewAIR.java:35)
com.adobe.flashruntime.air.VideoViewAIR$1.surfaceChanged (VideoViewAIR.java:58)
android.view.SurfaceView.updateWindow (SurfaceView.java:626)
android.view.SurfaceView.access$000 (SurfaceView.java:86)
android.view.SurfaceView$3.onPreDraw (SurfaceView.java:178)
android.view.ViewTreeObserver.dispatchOnPreDraw (ViewTreeObserver.java:707)
android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:1938)
android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1107)
android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:4464)
android.view.Choreographer$CallbackRecord.run (Choreographer.java:725)
android.view.Choreographer.doCallbacks (Choreographer.java:555)
android.view.Choreographer.doFrame (Choreographer.java:525)
android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:711)
android.os.Handler.handleCallback (Handler.java:615)
android.os.Handler.dispatchMessage (Handler.java:92)
android.os.Looper.loop (Looper.java:137)
android.app.ActivityThread.main (ActivityThread.java:4895)
java.lang.reflect.Method.invokeNative (Method.java)
java.lang.reflect.Method.invoke (Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:994)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:761)
dalvik.system.NativeStart.main (NativeStart.java)

Device info:

Device
Brand:samsung
Model:Galaxy Tab2 7.0
Orientation: Portrait
RAM free: 116.18 MB
Disk free: 3.28 GB
Operating System
Version:4.1.2
Orientation: Portrait
Rooted:No

shaymolho avatar Sep 26 '21 14:09 shaymolho

Version:4.1.2

So this looks like it's a duplicate of https://github.com/airsdk/Adobe-Runtime-Support/issues/278 Are you able to check with 33.1.1.533 or later?

thanks

ajwfrost avatar Sep 27 '21 08:09 ajwfrost

AIR 33.1.1.713 Crash brightness_1 Samsung Galaxy J2 Core Android 8.1 (SDK 27)

java.lang.UnsatisfiedLinkError: at com.adobe.flashruntime.air.VideoViewAIR.nativeSetSurfaceSize (Native Method) at com.adobe.flashruntime.air.VideoViewAIR.access$000 (VideoViewAIR.java:35) at com.adobe.flashruntime.air.VideoViewAIR$1.surfaceChanged (VideoViewAIR.java:58) at android.view.SurfaceView.updateSurface (SurfaceView.java:675) at android.view.SurfaceView$2.onPreDraw (SurfaceView.java:143) at android.view.ViewTreeObserver.dispatchOnPreDraw (ViewTreeObserver.java:977) at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:2407) at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1429) at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:6823) at android.view.Choreographer$CallbackRecord.run (Choreographer.java:911) at android.view.Choreographer.doCallbacks (Choreographer.java:723) at android.view.Choreographer.doFrame (Choreographer.java:658) at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:897) at android.os.Handler.handleCallback (Handler.java:790) at android.os.Handler.dispatchMessage (Handler.java:99) at android.os.Looper.loop (Looper.java:164) at android.app.ActivityThread.main (ActivityThread.java:6543) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:440) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:810)

bobrokrol avatar Jan 29 '22 20:01 bobrokrol

@bobrokrol can you just double-check you're building an ARMv7 binary for this one? There shouldn't be any such problem loading the binary on Android 8.1, and I've checked that they all contain the symbol (Java_com_adobe_flashruntime_air_VideoViewAIR_nativeSetSurfaceSize) so the only thing I was wondering is if the library isn't loading because it's the wrong binary format..?

Although I would have expected an issue earlier perhaps than this. Can you provide the full logcat including where it outputs the AIR RUNTIME: Version 33... and AIR VERSION: :33... bits?

thanks

ajwfrost avatar Jan 30 '22 22:01 ajwfrost

@bobrokrol can you just double-check you're building an ARMv7 binary for this one? There shouldn't be any such problem loading the binary on Android 8.1, and I've checked that they all contain the symbol (Java_com_adobe_flashruntime_air_VideoViewAIR_nativeSetSurfaceSize) so the only thing I was wondering is if the library isn't loading because it's the wrong binary format..?

Although I would have expected an issue earlier perhaps than this. Can you provide the full logcat including where it outputs the AIR RUNTIME: Version 33... and AIR VERSION: :33... bits?

thanks

Its crash from google play console. It happend on certain device 120 times yesterday and spoiled stats. I have no idea who could open an app that crashing 120 times. Is it possible that somebody download for example arm8 apk somehow and runned it on arm7 device? Would it produce same crash? Its not a critical as it does not happens on other devices too often. I have sent it just in case if you will able to fix it. There is other anr's / crashes that happens very often and already was reported

bobrokrol avatar Jan 30 '22 23:01 bobrokrol

Hi. We have similar crash. It's crash code from google play console. I can't replicate this crash. Do you know why it's happening?

java.lang.UnsatisfiedLinkError: at com.adobe.air.AIRWindowSurfaceView.nativeSurfaceCreated (Native Method) at com.adobe.air.AIRWindowSurfaceView.surfaceCreated (AIRWindowSurfaceView.java:739) at android.view.SurfaceView.updateSurface (SurfaceView.java:663) at android.view.SurfaceView$2.onPreDraw (SurfaceView.java:143) at android.view.ViewTreeObserver.dispatchOnPreDraw (ViewTreeObserver.java:977) at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:2407) at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1429) at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:6823) at android.view.Choreographer$CallbackRecord.run (Choreographer.java:911) at android.view.Choreographer.doCallbacks (Choreographer.java:723) at android.view.Choreographer.doFrame (Choreographer.java:658) at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:897) at android.os.Handler.handleCallback (Handler.java:790) at android.os.Handler.dispatchMessage (Handler.java:99) at android.os.Looper.loop (Looper.java:164) at android.app.ActivityThread.main (ActivityThread.java:6543) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:440) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:810)

Dima107 avatar Jan 31 '22 17:01 Dima107

@Dima107 do you have any information on the device? and on the version of AIR that was used? Plus do you see this as a new thing? The only time we'd had previous "unsatisfied link" errors was when (a) our library wouldn't load because it was linked against another library which I guess had some dependency on a later Android build version; and (b) when the native API changed.

The first of these should have been eliminated particularly since we're getting to this part - it's not a problem with loading the library in the first place, I think, as it's not got the right Java call stack for that. The APIs here shouldn't have changed, certainly they haven't recently!

Is there a chance we can get an APK and try it on an old phone here?

thanks

ajwfrost avatar Jan 31 '22 19:01 ajwfrost

Just FYI we've re-tried 33.1.1.406 on an ARMv7 device running Jellybean (API 16, Android 4.1) and get the same:

D/dalvikvm( 1636): Trying to load lib /data/data/air.AIRTestHarness/lib/libc++_shared.so 0xaeb09eb8
D/dalvikvm( 1636): Added shared lib /data/data/air.AIRTestHarness/lib/libc++_shared.so 0xaeb09eb8
D/dalvikvm( 1636): No JNI_OnLoad found in /data/data/air.AIRTestHarness/lib/libc++_shared.so 0xaeb09eb8, skipping init
D/dalvikvm( 1636): Trying to load lib /data/data/air.AIRTestHarness/lib/libCore.so 0xaeb09eb8
D/dalvikvm( 1636): Trying to load lib /data/data/air.AIRTestHarness/lib/libCore.so 0xaeb09eb8
D/EGL_emulation( 1028): eglMakeCurrent: 0xb7ba8e68: ver 2 0
W/dalvikvm( 1636): No implementation found for native Lcom/adobe/air/AIRWindowSurfaceView;.nativeSurfaceCreated:()V
D/AndroidRuntime( 1636): Shutting down VM
W/dalvikvm( 1636): threadid=1: thread exiting with uncaught exception (group=0xae5b92a0)
E/AndroidRuntime( 1636): FATAL EXCEPTION: main
E/AndroidRuntime( 1636): java.lang.UnsatisfiedLinkError: Native method not found: com.adobe.air.AIRWindowSurfaceView.nativeSurfaceCreated:()V
E/AndroidRuntime( 1636): 	at com.adobe.air.AIRWindowSurfaceView.nativeSurfaceCreated(Native Method)
...

So it seems like there is a dependency upon something still and I would bet it's the Skia library which is what we've always had a lot of problems with.

When I try our new (not-quite-released) build, we get:

D/dalvikvm( 1681): Trying to load lib /data/data/air.AIRTestHarness/lib/libc++_shared.so 0xaeb0ad78
D/dalvikvm( 1681): Added shared lib /data/data/air.AIRTestHarness/lib/libc++_shared.so 0xaeb0ad78
D/dalvikvm( 1681): No JNI_OnLoad found in /data/data/air.AIRTestHarness/lib/libc++_shared.so 0xaeb0ad78, skipping init
D/dalvikvm( 1681): Trying to load lib /data/data/air.AIRTestHarness/lib/libCore.so 0xaeb0ad78
D/EGL_emulation( 1028): eglMakeCurrent: 0xb7ba8e68: ver 2 0
D/dalvikvm( 1681): Added shared lib /data/data/air.AIRTestHarness/lib/libCore.so 0xaeb0ad78
D/dalvikvm( 1681): GC_CONCURRENT freed 343K, 10% free 5366K/5959K, paused 26ms+2ms, total 100ms
D/AIRRuntimeCheck( 1681): AIR - showing Splash Screen
...
W/dalvikvm( 1681): JNI WARNING: expected return type 'I'
W/dalvikvm( 1681):              calling Landroid/graphics/Paint;.setFlags (I)V
W/dalvikvm( 1681):              in Lcom/adobe/air/Entrypoints;.EntryMainWrapper:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;ZZ)V (CallIntMethodA)
I/dalvikvm( 1681): "main" prio=5 tid=1 NATIVE
I/dalvikvm( 1681):   | group="main" sCount=0 dsCount=0 obj=0xae5ba508 self=0xb7a069e0
I/dalvikvm( 1681):   | sysTid=1681 nice=0 sched=0/0 cgrp=apps handle=-1225074896
I/dalvikvm( 1681):   | schedstat=( 1096856928 786535968 639 ) utm=81 stm=28 core=0
F/libc    ( 1681): Fatal signal 11 (SIGSEGV) at 0x0000001f (code=1), thread 1681 (.AIRTestHarness)
...

So basically you can see this time, the AIR runtime library (libCore.so) is loading properly... but then we have an error which it seems is because it reckons android.graphics.Paint::setFlags() should return an int... Well, not according to the documentation ... (and not on newer devices...) which implies that they've changed the API without telling anyone.

So that we will need to fix/work around..

For the different stack traces and my earlier confusion about the VideoViewAIR.nativeSetSurfaceSize method: it looks like this may just be because if you have the containsVideo flag in your app descriptor, we get a VideoViewAIR object added to the top of the view stack (for StageVideo) and this is then what's first triggered from android.view.SurfaceView.updateSurface; if you don't have this flag then it would first call the AIRWindowSurfaceView object. Both of these classes are then calling a native/JNI function and failing because the library isn't loaded.

You'd also have thought we'd have a better way of detecting the fact we don't have the runtime library loaded, and failing a little more gracefully....

ajwfrost avatar Feb 01 '22 11:02 ajwfrost

it reckons android.graphics.Paint::setFlags() should return an int... Well, not according to the documentation ... (and not on newer devices...) which implies that they've changed the API without telling anyone.

With apologies to the Android folk ... it's not that the API had changed, it's that we were trying to set the value via the JNI function CallIntMethodA whereas it should have been CallVoidMethodA. I guess the JNI 'glue' is a little more forgiving on the later Android releases...

ajwfrost avatar Feb 01 '22 12:02 ajwfrost

@ajwfrost, this crash on start returns back with latest AIR 50.2.3.7 for some devices:

E  FATAL EXCEPTION: main
	Process: my.air.app, PID: 5438
	java.lang.UnsatisfiedLinkError: No implementation found for void com.adobe.flashruntime.air.VideoViewAIR.nativeSetSurfaceSize(long, int, int) (tried Java_com_adobe_flashruntime_air_VideoViewAIR_nativeSetSurfaceSize and Java_com_adobe_flashruntime_air_VideoViewAIR_nativeSetSurfaceSize__JII)
		at com.adobe.flashruntime.air.VideoViewAIR.nativeSetSurfaceSize(Native Method)
		at com.adobe.flashruntime.air.VideoViewAIR.access$000(VideoViewAIR.java:35)
		at com.adobe.flashruntime.air.VideoViewAIR$1.surfaceChanged(VideoViewAIR.java:58)
		at android.view.SurfaceView.updateSurface(SurfaceView.java:1300)
		at android.view.SurfaceView$1.onPreDraw(SurfaceView.java:225)
		at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1124)
		at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3854)
		at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2618)
		at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9971)
		at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1010)
		at android.view.Choreographer.doCallbacks(Choreographer.java:809)
		at android.view.Choreographer.doFrame(Choreographer.java:744)
		at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:995)
		at android.os.Handler.handleCallback(Handler.java:938)
		at android.os.Handler.dispatchMessage(Handler.java:99)
		at android.os.Looper.loop(Looper.java:246)
		at android.app.ActivityThread.main(ActivityThread.java:8653)
		at java.lang.reflect.Method.invoke(Native Method)
		at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
		at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

Tested with Samsung Galaxy A40 SM-A405FM, Android 11 With AIR 50.2.3.5 it works fine.

itlancer avatar Nov 08 '23 10:11 itlancer

@ajwfrost Seems fixed with latest AIR 50.2.3.8. Cannot reproduce it anymore. But with AIR 50.2.3.7 it still reproducible. So it's not one-time device failure.

itlancer avatar Nov 08 '23 13:11 itlancer

So this (recently) may have been impacted by the changes we'd made in relation to #2772 - but also, based on some other logs provided and further investigations (and in particular the fact it always seems to be this VideoViewAIR.nativeSetSurfaceSize going wrong) we believe there may be some asynchronous challenges between the runtime loading and registering itself, and the surfaces being created and triggering this callback.

So we're adding some extra protection around this call that will make it match the other native functions that are in the base class of this one.. which should mean we no longer get this problem..

ajwfrost avatar Dec 07 '23 10:12 ajwfrost