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

Author Topic: How to debug NDK-projects?  (Read 1364 times)

0 Members and 1 Guest are viewing this topic.

Cyrana

  • Newbie
  • *
  • Posts: 21
    • View Profile
How to debug NDK-projects?
« on: February 27, 2017, 02:30:33 pm »
Hello forum : )

My android-application "stops working" upon starting.
Is there a way to debug this? The SFML example worked perfectly fine, could play around with it and nothing stopped working, but my own project is a bit larger and depends on Lua as well.

At the moment, I'm using
ndk-build
apt debug
adb install
and then run it.

When I start the app, I cannot see anything at all (but the upper bar with the app's name - android's interface, not mine) - stops working.
Building etc. worked fine.

SFML: 2.3.2
NDK: r13b
Lua: 5.1

Since Nsight Tegra probably won't help according to this http://en.sfml-dev.org/forums/index.php?topic=21513.0, stating that I cannot debug my app running, what are my options : /? Blindly guessing?
As I use Lua, might it be that something went wrong with linking it and they fail to find the .so files during runtime but manage to ndk-build it anyway?

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := sfml-game

LOCAL_SRC_FILES := main.cpp
LOCAL_SRC_FILES += ...

LOCAL_CPPFLAGS  = -std=c++1y
LOCAL_CPPFLAGS += -lstdc++fs
LOCAL_CPP_FEATURES := rtti exceptions

LOCAL_SHARED_LIBRARIES := sfml-system
LOCAL_SHARED_LIBRARIES += sfml-window
LOCAL_SHARED_LIBRARIES += sfml-graphics
LOCAL_SHARED_LIBRARIES += sfml-audio
LOCAL_SHARED_LIBRARIES += sfml-network
LOCAL_SHARED_LIBRARIES += lua

LOCAL_WHOLE_STATIC_LIBRARIES := sfml-main

include $(BUILD_SHARED_LIBRARY)

$(call import-module,sfml)
$(call import-module,lua\jni)

cvkfak

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: How to debug NDK-projects?
« Reply #1 on: March 01, 2017, 02:44:41 am »
My android-application "stops working" upon starting.
Is there a way to debug this? The SFML example worked perfectly fine, could play around with it and nothing stopped working, but my own project is a bit larger and depends on Lua as well.
Probably you forgot to put
Code: [Select]
if (event.type == sf::Event::Closed)
            {
                window.close();
            }

            if (event.type == sf::Event::Resized)
            {
                view.setSize(event.size.width, event.size.height);
                view.setCenter(event.size.width/2, event.size.height/2);
                window.setView(view);
            }
and sf::View view = window.getDefaultView(); before the main loop

Cyrana

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: How to debug NDK-projects?
« Reply #2 on: March 02, 2017, 03:42:21 pm »
Adding sf::View view = window.getDefaultView(); does not fix it, sadly.

I started to remove certain sections of my code. Could it be that multiple views aren't allowed on Android builds?

Edit: Or could it be that certain files have not been shipped and it fails finding them ergo crashes... Have to check this in a bit.

Edit 2: Yes... I ship wrong files :' D I expect too much automation - of course I have to add them manually, sorry xD!

Edit 3: Might be worth another thread, but can I just drop everything in my assets folder? The SFML-example used that one, but seems not to work : O
I have an asset folder for graphics and a few other folders for different scripts.
« Last Edit: March 02, 2017, 05:24:48 pm by Cyrana »