Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Android build error on launch  (Read 952 times)

0 Members and 1 Guest are viewing this topic.

Nafffen

  • Newbie
  • *
  • Posts: 20
    • View Profile
Android build error on launch
« on: August 15, 2023, 01:29:11 pm »
Hey,
I am trying to follow the guide with SFML 2.6 on android https://github.com/SFML/SFML/wiki/Tutorial:-Building-SFML-for-Android-on-Windows-with-Android-Studio
Build passed but on execution I have a fatal error :
Code: [Select]
2023-08-15 12:55:24.780 20653-20653 libEGL                  com.you.example.debug                E  validate_display:89 error 3001 (EGL_NOT_INITIALIZED)
2023-08-15 12:55:24.781 20653-20653 libc                    com.you.example.debug                A  C:\FactoryCapi\external_deps\SFML\src\SFML\System\Android\Activity.cpp:75: sf::priv::ActivityStates &sf::priv::getActivity(): assertion "states != NULL" failed
2023-08-15 12:55:24.781 20653-20653 libc                    com.you.example.debug                A  Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 20653 (u.example.debug), pid 20653 (u.example.debug)
I am using several libraries with SFML but I already made a simple project to check them and it was ok (launched as expected).
By simple project I mean a single main.cpp that calls some methods of each lib, so a very simple cmake.

But now I'm using my full source of my game with intermediate lib building and I have this error.
Just want to know if some of you already dealt with this, or have any idea about where the problem could come from.
The error occurred before the main is executed.

To give a little bit more information, here is my cmake lib dependency flow:
The example lib finally built relies on a custom lib FactoryCapi_flow
Code: [Select]
target_link_libraries(example PUBLIC
    FactoryCapi_flow
    log
    android
    sfml-graphics
    sfml-audio
    sfml-activity
    sfml-network
    -Wl,--whole-archive sfml-main -Wl,--no-whole-archive
    TGUI::TGUI
    TGUI::Activity
    EnTT::EnTT
    openal
    EGL
    GLESv1_CM
)
FactoryCapi_flow relies on FactoryCapi_core
Code: [Select]
target_link_libraries(
  FactoryCapi_flow PUBLIC
  FactoryCapi_core
)
FactoryCapi_core is built with those lib
Code: [Select]
target_link_libraries(
  FactoryCapi_core PUBLIC
  sfml-graphics
  sfml-system
  absl::flags
  absl::flags_parse
#  gRPC::grpc++_reflection
  gRPC::grpc++
  protobuf::libprotobuf
  quill::quill
)
In AndroidManifest.xml, I have
Code: [Select]
<meta-data android:name="android.app.lib_name" android:value="sfml-activity-d" />
<meta-data android:name="sfml.app.lib_name" android:value="tgui-activity-d" />
<meta-data android:name="tgui.app.lib_name" android:value="example" />
Thank you

arash28134

  • Newbie
  • *
  • Posts: 4
  • Stayin' still, eyes closed, let the world pass by
    • View Profile
    • My Github
    • Email
Re: Android build error on launch
« Reply #1 on: August 16, 2023, 08:52:26 am »
First error suggests an issue with EGL initialization. make sure that you're initializing EGL properly before using it.

Nafffen

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Android build error on launch
« Reply #2 on: August 16, 2023, 01:11:38 pm »
One of my custom file was using sf::Shader, unavailable on android with SFML.
Anyway now it's working, thank you