Android OGL-ES test project crashing

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
zenolijo
Posts: 5
Joined: Thu Sep 25, 2014 1:32 pm

Android OGL-ES test project crashing

Post by zenolijo »

So i have been playing around with irrlicht a little the past week and decided to try to make a android project, so i checked out the ogl-es branch from sourceforge and started with example 27.HelloWorld_Android.
I compiled the libIrrlicht.a file by running ndk-build from source/Irrlicht/Android and then cd'ed into the project directory, did ndk-build and ant debug and there were no critical errors.
I have configured adb to work wirelessly and used it to install the HelloWorldMobile-debug.apk app to my phone and ran ndk-gdb --start --verbose bin/HelloWorldMobile-debug.apk.

And now the app just crashes. I do not know what's the problem because i don't see any errors in gdb nor catlog.
Does anyone else have a clue?


GDB output

Code: Select all

 
Android NDK installation path: /opt/android-ndk64
Using default adb command: /opt/android-sdk/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.31
Using ADB flags: 
Using JDB command: /opt/java/bin/jdb
Using auto-detected project path: .
Found package name: com.irrlicht.example
ABIs targetted by application: armeabi
Device API Level: 19
Device CPU ABIs: armeabi-v7a armeabi
Compatible device ABI: armeabi
Using gdb setup init: ./libs/armeabi/gdb.setup
Using toolchain prefix: /opt/android-ndk64/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
Using app out directory: ./obj/local/armeabi
Found debuggable flag: true
Found data directory: '/data/data/com.irrlicht.example'
Found device gdbserver: /data/data/com.irrlicht.example/lib/gdbserver
Found first launchable activity: android.app.NativeActivity
Launching activity: com.irrlicht.example/android.app.NativeActivity
## COMMAND: adb_cmd shell am start -D -n com.irrlicht.example/android.app.NativeActivity
WARNING: linker: app_process has text relocations. This is wasting memory and is a security risk. Please fix.
WARNING: linker: app_process has text relocations. This is wasting memory and is a security risk. Please fix.
Starting: Intent { cmp=com.irrlicht.example/android.app.NativeActivity }
## COMMAND: adb_cmd shell sleep 2
Found running PID: 15330
Launched gdbserver succesfully.
Setup network redirection
## COMMAND: adb_cmd forward tcp:5039 localfilesystem:/data/data/com.irrlicht.example/debug-socket
## COMMAND: adb_cmd shell run-as com.irrlicht.example /data/data/com.irrlicht.example/lib/gdbserver +debug-socket --attach 15330
## COMMAND: adb_cmd pull /system/bin/app_process ./obj/local/armeabi/app_process
/data/data/com.irrlicht.example/lib/gdbserver[1]: .�aN�RB��c���6�~6��{�������c: not found
/data/data/com.irrlicht.example/lib/gdbserver: no closing quote
199 KB/s (21980 bytes in 0.107s)
Pulled app_process from device/emulator.
## COMMAND: adb_cmd pull /system/bin/linker ./obj/local/armeabi/linker
451 KB/s (63664 bytes in 0.137s)
Pulled linker from device/emulator.
## COMMAND: adb_cmd pull /system/lib/libc.so ./obj/local/armeabi/libc.so
783 KB/s (310652 bytes in 0.387s)
Pulled libc.so from device/emulator.
Setup JDB connection
## COMMAND: adb_cmd forward tcp:65534 jdwp:15330
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
Initializing jdb ...
> Input stream closed.
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-linux-android".
For bug reporting instructions, please see:
<http://source.android.com/source/report-bugs.html>.
./obj/local/armeabi/gdb.setup:4: Error in sourced command file:
Remote communication error. Target disconnected.: Connection reset by peer
(gdb) q
 
Logcat
http://pastebin.com/J7raG9GR
CuteAlien
Admin
Posts: 9679
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Android OGL-ES test project crashing

Post by CuteAlien »

What happens when you start without gdb? Working with gdb on Android is painful. I think I got it working once with several pauses on start or maybe I even connected gdb later... something like that. I switched to getting gl es running on my desktop and writing some code which allows me to test nearly everything on desktop so I never have to debug on Android for most problems. For the rest I work with logging information and got lucky so far and didn't have to touch gdb on Android again.

The NDK toolchain on Android is sometimes pretty horrible even for embedded standards.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
zenolijo
Posts: 5
Joined: Thu Sep 25, 2014 1:32 pm

Re: Android OGL-ES test project crashing

Post by zenolijo »

CuteAlien wrote:What happens when you start without gdb?
Same, crashes instantly but with even less catlog info.
CuteAlien wrote:Working with gdb on Android is painful. I think I got it working once with several pauses on start or maybe I even connected gdb later... something like that. I switched to getting gl es running on my desktop and writing some code which allows me to test nearly everything on desktop so I never have to debug on Android for most problems. For the rest I work with logging information and got lucky so far and didn't have to touch gdb on Android again.
I will try to modify the code so it's runnable on both linux and android, we'll see how it goes.
CuteAlien
Admin
Posts: 9679
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Android OGL-ES test project crashing

Post by CuteAlien »

Can you post that catlog info as well? Having less info sometimes makes it easier to see what's going wrong.

edit: Also makes sure you have an up-to-date ndk installation. I wasted once a day because I was running into a bug of ndk - and an ndk update made the app work.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
CuteAlien
Admin
Posts: 9679
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Android OGL-ES test project crashing

Post by CuteAlien »

While I do not really think this caused the crash, I did find a small problem in the manifest file. It only required es1.0 from the device while the main.cpp requested es2.0. Shouldn't really be a problem on new devices, but just in case I've updated it in svn.

You might also give es1.0 a shot (just comment the other line in at the place where the driver is selected).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
zenolijo
Posts: 5
Joined: Thu Sep 25, 2014 1:32 pm

Re: Android OGL-ES test project crashing

Post by zenolijo »

CuteAlien wrote: Can you post that catlog info as well? Having less info sometimes makes it easier to see what's going wrong.
http://pastebin.com/x0jPAz51
CuteAlien wrote: edit: Also makes sure you have an up-to-date ndk installation. I wasted once a day because I was running into a bug of ndk - and an ndk update made the app work.
I have the latest ndk, sdk and platform tools installed.

I will continue trying to make a cross compilable version of the example.
FloatyBoaty
Posts: 32
Joined: Thu Aug 21, 2014 11:39 pm

Re: Android OGL-ES test project crashing

Post by FloatyBoaty »

Even if you have a 64bit machine, use the *ndk32* version (x86 target). May not be an issue for you, but it was a real headache for me.
CuteAlien
Admin
Posts: 9679
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Android OGL-ES test project crashing

Post by CuteAlien »

Thanks for the other log. Unfortuntely I still don't know what's going on. Which android device is this?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
zenolijo
Posts: 5
Joined: Thu Sep 25, 2014 1:32 pm

Re: Android OGL-ES test project crashing

Post by zenolijo »

CuteAlien wrote:While I do not really think this caused the crash, I did find a small problem in the manifest file. It only required es1.0 from the device while the main.cpp requested es2.0. Shouldn't really be a problem on new devices, but just in case I've updated it in svn.
Missed that you wrote this before, just tried the new one, compiled it and tried with both EDT_OGLES2 and EDT_OGLES1 and neither worked.

You might also give es1.0 a shot (just comment the other line in at the place where the driver is selected).
FloatyBoaty wrote:Even if you have a 64bit machine, use the *ndk32* version (x86 target). May not be an issue for you, but it was a real headache for me.
I had no idea about this, and would make alot of sense. I'll install the 32-bit version and see.
CuteAlien wrote:Thanks for the other log. Unfortuntely I still don't know what's going on. Which android device is this?
Nexus 5 running 4.4.4 paranoid android.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Android OGL-ES test project crashing

Post by Nadro »

09-26 23:00:06.342 E/AndroidRuntime( 2585): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.irrlicht.example/android.app.NativeActivity}: java.lang.IllegalArgumentException: Unable to load native library: /data/app-lib/com.irrlicht.example-1/libHelloWorldMobile.so
*.so file is missing or has wrong arch eg. 64 bits on 32 bits OS, thats why Activity doesn't start. As FloatyBoaty said please install ndk32 and check the logs from "ndk-build" command.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
CuteAlien
Admin
Posts: 9679
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Android OGL-ES test project crashing

Post by CuteAlien »

Yeah, maybe a good idea checking if that file exists at all. You can rename .apk to .zip then you can look at the files with any unzip tool (some unzip tools might also be able to handle it without renaming).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
FloatyBoaty
Posts: 32
Joined: Thu Aug 21, 2014 11:39 pm

Re: Android OGL-ES test project crashing

Post by FloatyBoaty »

zenolijo wrote:
FloatyBoaty wrote:Even if you have a 64bit machine, use the *ndk32* version (x86 target). May not be an issue for you, but it was a real headache for me.
I had no idea about this, and would make alot of sense. I'll install the 32-bit version and see.
Forgot to mention that this is only applicable to the r10 of the ndk...
zenolijo
Posts: 5
Joined: Thu Sep 25, 2014 1:32 pm

Re: Android OGL-ES test project crashing

Post by zenolijo »

Thanks alot for the help guys, that fixed it!

Runs and compiles flawlessly now.
Post Reply