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

[Android][ANE] Warning: exception thrown from ANE function: returning a null value to ActionScript

Open Oldes opened this issue 1 year ago • 5 comments

Hi there,

I'm working on a native Android extension and when I call a function from an external dependency (not my source) it fails and in logcat I can see this error message with AdobeAIR tag:

Warning: exception thrown from ANE function: returning a null value to ActionScript

There is no other info what was wrong so I wonder if it would not be possible to provide some better info from AIR, which could help me to solve it (probably some missing classes). I'm using debug builds and have the application with android:debuggable="true" setting in its manifest.

Thanks.

Oldes avatar Feb 24 '24 11:02 Oldes

You can catch most things in your java / kotlin code and should be able to handle them there. This error normally means you have an unhandled exception occurring within the FREFunction.

I do agree however it probably would be helpful if AIR logged the stack trace of the exception that occurred.

marchbold avatar Feb 26 '24 01:02 marchbold

I think it may be best to output the Java exception stack trace only for debug builds? per the above if we have the 'debuggable' attribute on the app, we can print this out via logcat..

ajwfrost avatar Feb 26 '24 08:02 ajwfrost

@ajwfrost, yes, it will be great.

itlancer avatar Feb 26 '24 09:02 itlancer

I'd see no reason not to include it in a release too. Can be helpful when debugging a live app, though honestly these particular errors normally only occur while developing so happy for either.

marchbold avatar Feb 27 '24 08:02 marchbold

I'd see no reason not to include it in a release too.

It has to be said, it's pretty trivial to do this for all code, so if there are no major objections, we'll just do that...

jEnv->ExceptionDescribe();

results in:

2024-02-28 15:34:40.085 23154-23154 AdobeAIR                air.com.harman.air.TestPAD           E  Warning: exception thrown from ANE function: returning a null value to ActionScript
2024-02-28 15:34:40.085 23154-23154 System.err              air.com.harman.air.TestPAD           W  java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.adobe.fre.FREObject.getAsString()' on a null object reference
2024-02-28 15:34:40.085 23154-23154 System.err              air.com.harman.air.TestPAD           W  	at com.harman.PlayAssetDelivery.OpenInstallTimeAsset.call(OpenInstallTimeAsset.java:47)
2024-02-28 15:34:40.086 23154-23154 System.err              air.com.harman.air.TestPAD           W  	at com.adobe.air.customHandler.nativeOnTouchCallback(Native Method)
2024-02-28 15:34:40.086 23154-23154 System.err              air.com.harman.air.TestPAD           W  	at com.adobe.air.customHandler.handleMessage(customHandler.java:39)
2024-02-28 15:34:40.086 23154-23154 System.err              air.com.harman.air.TestPAD           W  	at android.os.Handler.dispatchMessage(Handler.java:106)
2024-02-28 15:34:40.086 23154-23154 System.err              air.com.harman.air.TestPAD           W  	at android.os.Looper.loopOnce(Looper.java:226)
2024-02-28 15:34:40.086 23154-23154 System.err              air.com.harman.air.TestPAD           W  	at android.os.Looper.loop(Looper.java:313)
2024-02-28 15:34:40.086 23154-23154 System.err              air.com.harman.air.TestPAD           W  	at android.app.ActivityThread.main(ActivityThread.java:8762)
2024-02-28 15:34:40.086 23154-23154 System.err              air.com.harman.air.TestPAD           W  	at java.lang.reflect.Method.invoke(Native Method)
2024-02-28 15:34:40.086 23154-23154 System.err              air.com.harman.air.TestPAD           W  	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
2024-02-28 15:34:40.086 23154-23154 System.err              air.com.harman.air.TestPAD           W  	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

Actually all that you need I guess is what's above the com.adobe.air.customHandler part, but hopefully this is useful anyway.

thanks

ajwfrost avatar Feb 28 '24 15:02 ajwfrost