funexpected / godot-flash-module

MIT License
39 stars 3 forks source link

Hi, failed to get it working in Android Export #14

Closed learnyTown closed 11 months ago

learnyTown commented 1 year ago

Black screen & app closes. ( godot 3.5)

Does this work for android?

Please give instruction, on how to build for android, iOS & html

This is the error we are getting: (logcat)

ERROR: Cannot get class 'FlashDocument'. 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E at: _get_parent_class (core/class_db.cpp:323) - Condition "!ti" is true. Returned: StringName() 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E ERROR: Cannot get class 'FlashDocument'. 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E at: _get_parent_class (core/class_db.cpp:323) - Condition "!ti" is true. Returned: StringName() 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E ERROR: Cannot get class 'FlashDocument'. 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E at: _get_parent_class (core/class_db.cpp:323) - Condition "!ti" is true. Returned: StringName() 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E ERROR: Cannot get class 'FlashDocument'. 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E at: _get_parent_class (core/class_db.cpp:323) - Condition "!ti" is true. Returned: StringName() 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E ERROR: Cannot get class 'FlashDocument'. 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E at: _get_parent_class (core/class_db.cpp:323) - Condition "!ti" is true. Returned: StringName() 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E ERROR: No loader found for resource: res://.import/cow-animation.zfl-d57a70b9c2b7348e62da9c5c812ef4f8.etc2.res. 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E at: _load (core/io/resource_loader.cpp:278) - Method failed. Returning: RES() 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E ERROR: Cannot get class 'FlashDocument'. 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E at: _get_parent_class (core/class_db.cpp:323) - Condition "!ti" is true. Returned: StringName() 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E ERROR: Cannot get class 'FlashDocument'. 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E at: _get_parent_class (core/class_db.cpp:323) - Condition "!ti" is true. Returned: StringName() 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E ERROR: Failed loading resource: res://cow-animation.zfl. Make sure resources have been imported by opening the project in the editor at least once. 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E at: _load (core/io/resource_loader.cpp:271) - Condition "found" is true. Returned: RES() 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E ERROR: res://flashTryScene.tscn:3 - Parse Error: [ext_resource] referenced nonexistent resource at: res://cow-animation.zfl 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E at: poll (scene/resources/resource_format_text.cpp:412) - res://flashTryScene.tscn:3 - Parse Error: [ext_resource] referenced nonexistent resource at: res://cow-animation.zfl 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E ERROR: Failed to load resource 'res://flashTryScene.tscn'. 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E at: load (core/io/resource_loader.cpp:206) - Condition "err != OK" is true. Returned: RES() 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E ERROR: Failed loading resource: res://flashTryScene.tscn. Make sure resources have been imported by opening the project in the editor at least once. 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E at: _load (core/io/resource_loader.cpp:271) - Condition "found" is true. Returned: RES() 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E ERROR: Failed loading scene: res://flashTryScene.tscn 2023-10-13 14:02:22.888 18805-18963 godot org.godotengine.flashTry E at: start (main/main.cpp:2107) - Condition "!scene" is true. Returned: false 2023-10-13 14:02:23.046 18805-18963 godot org.godotengine.flashTry E ERROR: Condition "default_certs != nullptr" is true. 2023-10-13 14:02:23.046 18805-18963 godot org.godotengine.flashTry E at: load_default_certificates (modules/mbedtls/crypto_mbedtls.cpp:314) - Condition "default_certs != nullptr" is true. 2023-10-13 14:02:23.046 18805-18963 godot org.godotengine.flashTry E ERROR: Cannot get class 'FlashDocument'. 2023-10-13 14:02:23.047 18805-18963 godot org.godotengine.flashTry E at: _get_parent_class (core/class_db.cpp:323) - Condition "!ti" is true. Returned: StringName() 2023-10-13 14:02:23.047 18805-18963 godot org.godotengine.flashTry E ERROR: Cannot get class 'FlashDocument'.

jkb0o commented 1 year ago

This works everywhere. You just need:

  1. clone godot source of required version:
    git clone --branch 3.5 https://github.com/godotengine/godot.git
  2. put content of godot-flash-module into $GODOT/modules/flash
    cd godot/modules
    git clone https://github.com/funexpected/godot-flash-module.git flash
  3. build android/ios/web templates by following official instructions:
  4. Export your project using these templates
learnyTown commented 1 year ago

This works everywhere. You just need:

  1. clone godot source of required version:
git clone --branch 3.5 https://github.com/godotengine/godot.git
  1. put content of godot-flash-module into $GODOT/modules/flash
cd godot/modules
git clone https://github.com/funexpected/godot-flash-module.git flash
  1. build android/ios/web templates by following official instructions:
  1. Export your project using these templates

Sir, Now getting this error: When I export the project for Android without FlashPlayer Resource, only empty flashPlayer node, that time it creates a fine APK, but when I add the resource to the FlashPlayer that time it crashes the APK. It gives the Black screen and crashes the app.

Built with Godot 3.5.3.

Tried multiple times.

2023-10-18 10:49:03.270 17413-17413 DEBUG                   pid-17413                            A        #00 pc 00000000007320d4  /data/app/~~3VoYoJURxzwUn2TdZaZE_A==/com.learny.game-IU4urhnxApb38X964uqN9A==/lib/arm64/libgodot_android.so
2023-10-18 10:49:03.271 17413-17413 DEBUG                   pid-17413                            A        #01 pc 0000000001c92740  /data/app/~~3VoYoJURxzwUn2TdZaZE_A==/com.learny.game-IU4urhnxApb38X964uqN9A==/lib/arm64/libgodot_android.so
2023-10-18 10:49:03.271 17413-17413 DEBUG                   pid-17413                            A        #02 pc 0000000001c93474  /data/app/~~3VoYoJURxzwUn2TdZaZE_A==/com.learny.game-IU4urhnxApb38X964uqN9A==/lib/arm64/libgodot_android.so
2023-10-18 10:49:03.271 17413-17413 DEBUG                   pid-17413                            A        #03 pc 0000000001c7fafc  /data/app/~~3VoYoJURxzwUn2TdZaZE_A==/com.learny.game-IU4urhnxApb38X964uqN9A==/lib/arm64/libgodot_android.so
2023-10-18 10:49:03.271 17413-17413 DEBUG                   pid-17413                            A        #04 pc 0000000001c913fc  /data/app/~~3VoYoJURxzwUn2TdZaZE_A==/com.learny.game-IU4urhnxApb38X964uqN9A==/lib/arm64/libgodot_android.so
2023-10-18 10:49:03.271 17413-17413 DEBUG                   pid-17413                            A        #05 pc 0000000001c92740  /data/app/~~3VoYoJURxzwUn2TdZaZE_A==/com.learny.game-IU4urhnxApb38X964uqN9A==/lib/arm64/libgodot_android.so
2023-10-18 10:49:03.271 17413-17413 DEBUG                   pid-17413                            A        #06 pc 0000000001c8e14c  /data/app/~~3VoYoJURxzwUn2TdZaZE_A==/com.learny.game-IU4urhnxApb38X964uqN9A==/lib/arm64/libgodot_android.so
2023-10-18 10:49:03.271 17413-17413 DEBUG                   pid-17413                            A        #07 pc 0000000001c92740  /data/app/~~3VoYoJURxzwUn2TdZaZE_A==/com.learny.game-IU4urhnxApb38X964uqN9A==/lib/arm64/libgodot_android.so
2023-10-18 10:49:03.271 17413-17413 DEBUG                   pid-17413                            A        #08 pc 0000000001c93474  /data/app/~~3VoYoJURxzwUn2TdZaZE_A==/com.learny.game-IU4urhnxApb38X964uqN9A==/lib/arm64/libgodot_android.so
2023-10-18 10:49:03.271 17413-17413 DEBUG                   pid-17413                            A        #09 pc 00000000013ccfec  /data/app/~~3VoYoJURxzwUn2TdZaZE_A==/com.learny.game-IU4urhnxApb38X964uqN9A==/lib/arm64/libgodot_android.so
2023-10-18 10:49:03.271 17413-17413 DEBUG                   pid-17413                            A        #10 pc 0000000001c913fc  /data/app/~~3VoYoJURxzwUn2TdZaZE_A==/com.learny.game-IU4urhnxApb38X964uqN9A==/lib/arm64/libgodot_android.so
2023-10-18 10:49:03.271 17413-17413 DEBUG                   pid-17413                            A        #11 pc 0000000001c92740  /data/app/~~3VoYoJURxzwUn2TdZaZE_A==/com.learny.game-IU4urhnxApb38X964uqN9A==/lib/arm64/libgodot_android.so
2023-10-18 10:49:03.271 17413-17413 DEBUG                   pid-17413                            A        #12 pc 0000000001c93474  /data/app/~~3VoYoJURxzwUn2TdZaZE_A==/com.learny.game-IU4urhnxApb38X964uqN9A==/lib/arm64/libgodot_android.so
2023-10-18 10:49:03.271 17413-17413 DEBUG                   pid-17413                            A        #13 pc 000000000061c3e4  /data/app/~~3VoYoJURxzwUn2TdZaZE_A==/com.learny.game-IU4urhnxApb38X964uqN9A==/lib/arm64/libgodot_android.so
2023-10-18 10:49:03.271 17413-17413 DEBUG                   pid-17413                            A        #14 pc 00000000005ed7b8  /data/app/~~3VoYoJURxzwUn2TdZaZE_A==/com.learny.game-IU4urhnxApb38X964uqN9A==/lib/arm64/libgodot_android.so (Java_org_godotengine_godot_GodotLib_step+76)
jkb0o commented 1 year ago

but when I add the resource to the FlashPlayer that time it crashes the APK.

Is there any meaningful stack trace available?

learnyTown commented 1 year ago

but when I add the resource to the FlashPlayer that time it crashes the APK.

Is there any meaningful stack trace available?

FATAL EXCEPTION: main Process: org.godotengine.toddlertry, PID: 19756 java.lang.UnsatisfiedLinkError: dlopen failed: can't read file "/data/app/~~yYMTMkHSt-G01kHvSOlJ6w==/org.godotengine.toddlertry-wAjn-LNM0ptSt6WwJQA2mg==/lib/arm64/libgodot_android.so": Timer expired at java.lang.Runtime.loadLibrary0(Runtime.java:1082) at java.lang.Runtime.loadLibrary0(Runtime.java:1003) at java.lang.System.loadLibrary(System.java:1661) at org.godotengine.godot.GodotLib.(GodotLib.java:49) at org.godotengine.godot.Godot.initializeGodot(Godot.java:587) at org.godotengine.godot.Godot.onCreate(Godot.java:723) at androidx.fragment.app.Fragment.performCreate(Fragment.java:2949) at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:475) at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:278) at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100) at androidx.fragment.app.FragmentManager.execSingleAction(FragmentManager.java:1971) at androidx.fragment.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:311) at org.godotengine.godot.FullScreenGodotApp.onCreate(FullScreenGodotApp.java:69) at com.godot.game.GodotApp.onCreate(GodotApp.java:45) at android.app.Activity.performCreate(Activity.java:8191) at android.app.Activity.performCreate(Activity.java:8159) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1330) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3735) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3929) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2284) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:210) at android.os.Looper.loop(Looper.java:299) at android.app.ActivityThread.main(ActivityThread.java:8302) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1037)

App crashed on incremental package org.godotengine.toddlertry which is 45% loaded.

jkb0o commented 1 year ago

Hmmm. I have no idea yet. Can you please try to compile engine with flash module for desktop and check if it runs ok for your project?

We have a quite a big project for ios/android with a lot of flash and it just goes fine.

learnyTown commented 1 year ago

Hmmm. I have no idea yet. Can you please try to compile engine with flash module for desktop and check if it runs ok for your project?

We have a quite a big project for ios/android with a lot of flash and it just goes fine.

Sir I compiled this for the Desktop there is the same problem occurred and I used the Godot3.5.3 version and this will run properly when I remove the resource(.zfl) File from the FlashPlayer Node. sir, which version you have used for your Godot ?

jkb0o commented 1 year ago

Sir I compiled this for the Desktop there is the same problem occurred and I used the Godot3.5.3 version and this will run properly when I remove the resource(.zfl) File from the FlashPlayer Node. sir, which version you have used for your Godot ?

Sir, I have to be fair with you from now. I use my own very very patched version on the Godot on the top of3.3.1. This one: https://github.com/funexpected/godot.

I did publish the flash-plugin for the 3.5 in this is compiles + local test cases passes state. So it probably won't work with some other cases. Could you provide the minimal-reproduction-godot-project with some .zfl content?

learnyTown commented 1 year ago

Sir I compiled this for the Desktop there is the same problem occurred and I used the Godot3.5.3 version and this will run properly when I remove the resource(.zfl) File from the FlashPlayer Node. sir, which version you have used for your Godot ?

Sir, I have to be fair with you from now. I use my own very very patched version on the Godot on the top of3.3.1. This one: https://github.com/funexpected/godot.

I did publish the flash-plugin for the 3.5 in this is compiles + local test cases passes state. So it probably won't work with some other cases. Could you provide the minimal-reproduction-godot-project with some .zfl content?

https://github.com/Kids-App-Team2/LearnyTown This is the sample Flash Projects Directory with the Eye Blinking .zfl Resources file.

jkb0o commented 1 year ago

I just compiled 3.5.3 version and, start the editor, let the resource to import, close editor, start the binary with default scene and got blinking eyes. I'm using MacOS.

blink

Can you share details how did you compile the export templates and how you configure export presets?

learnyTown commented 1 year ago

Hi, this file worked in editor for us too.

But when we exported it for android with the android export template -> debug.apk & release.apk ( compiled with flash module for android),

the apk crashes with black screen.

can you please try building an apk or HTML that runs this animation ?

jkb0o commented 1 year ago

I will do it, but my timings on this is about 2-3 weeks, so your options are to dive or to wait.

learnyTown commented 1 year ago

Hi, will wait for your results. Also I am trying from my end to get this working.

As I want to get this started. Want to Get it running in html and android/ios.

Regards

learnyTown commented 1 year ago

Sir Our HTML exported FLA project is now Working! we compiled the Godot engine (v3.3.1) from your Source & integrating your flash module in it. Then in order to get our flash project work on web, we compiled it to get the web export templates. After exporting our flash project for web, we had to modify the javascript code to make it work in HTML. These are the steps we did - steps_for_flash_web_export1_txt.txt

Now we are facing another issue of HTML size. Its 180 mb! We found that this is probably because of the .wasm file in the export templates for web, which is that much large ~ 180mb. We saw that the normal .wasm file for a normal export template is about ~ 17-19 mb. There isn't any issue with the working of that exported project. Please consider this issue and give us a response.

jkb0o commented 11 months ago

I'm glad you were able to build the project! Lets continue the discussion about the build size in #16