Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Android service crashes when including quickandroid #26

Open
bbernhard opened this issue Aug 15, 2016 · 4 comments
Open

Android service crashes when including quickandroid #26

bbernhard opened this issue Aug 15, 2016 · 4 comments

Comments

@bbernhard
Copy link

bbernhard commented Aug 15, 2016

Hi,

first of all, many thanks for quickandroid. I installed the apk on my phone to look at the examples and this all looks very mature and well designed!

I am currently thinking about replacing my image picker implementation with your ImagePicker, as my implementation randomly throws the error "Can't find surface 1". In that case the whole Android gallery crashes. As your image picker implementation looks way more mature, I was thinking about to replace it with your's. I included the quickandroid.pri in my *.pro file and compiled the project. However, after running the application, my custom android service crashes. The android service gets started, when the application launches. What's really strange is, that I am not using anything from quickandroid, I just included the quickandroid.pri file. If I remove the quickandroid.pri file again, everything works fine.

Can you think of anything that might cause the crash? Before doing any reverse engineering I wanted you to ask if you have an idea what that can be.

Any help is really appreciated.

edit: I also added a minimal example project, if you want to take a look. If the *.pri file is included, a error appears when starting the application. If I remove the *.pri file, delete the build folder (don't know why this is necessary, but otherwise it doesn't get correctly rebuild) and rebuild again, the application starts just fine. (It's really a minimal example, so even if it starts correctly, you only see a white screen).
btw: the minimal example project is basically just this https://github.com/bbernhard/qtandroidservices_example together with the included quickandroid.

qtandroidservices_example.zip

Have a nice day,
Bernhard

@benlau
Copy link
Owner

benlau commented Aug 16, 2016

Hi @bbernhard ,

I have tried to run your example, but didn't crashed. Could you show me the error log you have?

Moreover, did you enable gradle? For ant, QuickAndroid will make a copy of its Java source code to build folder. I wonder is it the cause of crash. I think you could check about the build folder. And see is your Java source code installed correctly. (android-build/src)

@bbernhard
Copy link
Author

Hi @benlau ,

first of all, many thanks for helping me with this one.

Unfortunately I only get the error message in the app - there is no message in the Qt debugger. My assumption is, that it's because the Qt debugger is following the main application, whereas the service crashes. I attached a screenshot with the error message that's appearing. Sorry, it's in german...but it basically says "qtandroidservices_example stopped". The message appears immediately after starting the app. If I click "Ok" the app still works, so I assume it's the service that stopped.

I just checked the android-build/src folder and it contains a folder "quickandroid" with "ImagePicker.java", "QuickAndroidActivity.java" and "SystemDispatcher" as well as the "org/qtproject/example" folder structure with my custom activity/service.

gradle is disabled (just checked it again, to be sure)

screenshot_2016-08-16-18-10-12

Thanks,
Bernhard

@benlau
Copy link
Owner

benlau commented Aug 16, 2016

In case Qt creator can not show the error, you may use adb logcat and filter the error message (I know it is a bit trouble, should not have another better way)

@bbernhard
Copy link
Author

bbernhard commented Aug 16, 2016

Thanks for the info, didn't know that adb logcat can catch errors from a service.

I'll try that in a minute.

Do you maybe know a tool that can visualize logcat files? I am always redirecting the output into a file and search for error messages afterwards (don't know if there is a better way).

edit: It looks like that it's segfaulting (I can see a tombstone with logcat). I tried to use ndk-stack to get a more useful information, but unfortunately, I only get:

pid: 22869, tid: 22892, name: ject.example:qt >>> org.qtproject.example:qt <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0000002c
Stack frame #00 pc 0004d76c /system/lib/libdvm.so
Stack frame #1 pc 001c85d5 /data/app-lib/org.qtproject.example-2/libQt5Core.s
o: Routine ??
??:0

Really strange, that this is only happening on my phone.

edit: I also tried it on another smartphone with a different Android version (5.1 vs 4.1), but still the same.

Maybe it depends on the Qt version/android build version?

Thanks,
Bernhard

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants