SDL port for Android SDK/NDK 1.6

Quickly share your Android Code Snippets here...

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Wed Dec 21, 2011 12:07 pm

I think I've fixed that, please do "git pull".
Also, please don't rename the NDK directory extracted from the archive (it should be named android-ndk-r6-crystax-2, not just android-ndk-crystax) - my build system uses directory name to determine the NDK version, and enable/disable some quirks like using built-in STLPort.
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Top

Re: SDL port for Android SDK/NDK 1.6

Postby hagabaka » Thu Dec 22, 2011 12:44 am

pelya wrote:I think I've fixed that, please do "git pull".
Also, please don't rename the NDK directory extracted from the archive (it should be named android-ndk-r6-crystax-2, not just android-ndk-crystax) - my build system uses directory name to determine the NDK version, and enable/disable some quirks like using built-in STLPort.

Thank you. I installed NDK using a user-made buid script instead of downloading manually, so it was installed to /opt/android-ndk(-crystax). I downloaded manually and pulled, and now the process gets farther. I having a new error:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. -compile:
  2.     [javac] /opt/android-sdk/tools/ant/build.xml:600: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
  3.     [javac] Compiling 10 source files to /home/hagabaka/commandergenius/project/bin/classes
  4.     [javac] /home/hagabaka/commandergenius/project/src/MainActivity.java:391: method does not override or implement a method from a supertype
  5.     [javac]     @Override
  6.     [javac]     ^
  7.     [javac] /home/hagabaka/commandergenius/project/src/Video.java:486: cannot find symbol
  8.     [javac] symbol  : variable ACTION_HOVER_MOVE
  9.     [javac] location: class android.view.MotionEvent
  10.     [javac]                     event.getAction() == MotionEvent.ACTION_HOVER_MOVE))
  11.     [javac]                                                     ^
  12.     [javac] /home/hagabaka/commandergenius/project/src/Video.java:499: method does not override or implement a method from a supertype
  13.     [javac]     @Override
  14.     [javac]     ^
  15.     [javac] /home/hagabaka/commandergenius/project/src/Video.java:237: cannot find symbol
  16.     [javac] symbol  : variable ACTION_HOVER_MOVE
  17.     [javac] location: class android.view.MotionEvent
  18.     [javac]                     if( event.getAction() == MotionEvent.ACTION_HOVER_MOVE ) // Support bluetooth/USB mouse - available since Android 3.1
  19.     [javac]                                                         ^
  20.     [javac] 4 errors
  21.  
  22. BUILD FAILED
  23. /opt/android-sdk/tools/ant/build.xml:580: The following error occurred while executing this line:
  24. /opt/android-sdk/tools/ant/build.xml:600: Compile failed; see the compiler error output for details.
  25.  
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


I'm using openjdk and ant installed through Arch Linux packages. I don't have experience building an android or NDK package before, so I don't know if my environment isn't set up properly
hagabaka
Freshman
Freshman
 
Posts: 5
Joined: Wed Dec 21, 2011 1:50 am

Re: SDL port for Android SDK/NDK 1.6

Postby lmak » Thu Dec 22, 2011 9:53 am

Hey pelya,
just a couple of questions:
1. If I checked it correctly onscreen keyboard is not running on a separate thread from SDL? So it's blocking whenever onscreen keyboard is called. Would it be possible to put keyboard on a different thread? This could be archieved by sending the full buffer(when user presses return) as SDL_UserEvent to SDL.

2. Is it possible to do a runtime change for GLES-surface from 16 to 32bpp or the other way around?
lmak
Junior Developer
Junior Developer
 
Posts: 11
Joined: Thu Jan 20, 2011 7:16 pm

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Thu Dec 22, 2011 4:38 pm

hagabaka: you should set target=android-12 inside file project/project.properties , because it seems that you are compiling Java code with the older target, and it cannot compile the USB mouse support code (ACTION_HOVER_MOVE event is declared only starting from Android 3.1, which is android-12 API level).
Also I never tried to use openjdk, I'm using sun-java6-jdk, however openjdk should work, according to the Android docs.

If I checked it correctly onscreen keyboard is not running on a separate thread from SDL? So it's blocking whenever onscreen keyboard is called. Would it be possible to put keyboard on a different thread? This could be archieved by sending the full buffer(when user presses return) as SDL_UserEvent to SDL.

Function SDL_ANDROID_ToggleScreenKeyboardTextInput() defined in SDL_screenkeyboard.h will not block, and it will send text input as a multiple SDK_KEYDOWN/KEYUP events. SDL 1.3 defines a dedicated SDL_TEXTINPUT event, and it's sent whenever you're using SDL 1.3 (you can set that in AndroidAppSettings.cfg), however there's no such event in SDL 1.2. Pressing text input button in the upper-left corner of the screen also will not block.
On the contrary the SDL_ANDROID_GetScreenKeyboardTextInput() will block, until the user has finished text input.

Is it possible to do a runtime change for GLES-surface from 16 to 32bpp or the other way around?

Not possible with my port, it would be possible with an official SDL 1.3 port from libsdl.org, if only the official port supported screen depth other than 32 bit. I want to add an option to the SDL startup menu, to select between 16 and 24 bit color modes, for applications that will support it (and possibly auto-select it, guessing from the phone model), however I cannot tell when it will be done.
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Re: SDL port for Android SDK/NDK 1.6

Postby hagabaka » Thu Dec 22, 2011 9:32 pm

Now the package builds correctly, and even runs briefly, displaying some graphics on my phone before it quits. I tried to use ndk-gdb --verbose --start --force as your README says, but it shows
Code: Select all
Android NDK installation path: /home/hagabaka/android-ndk-r7
Using default adb command: /opt/android-sdk/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.29
Using final ADB command: '/opt/android-sdk/platform-tools/adb'
Using auto-detected project path: .
Found package name: com.frogatto
jni/../jni/vcmi/Android.mk:9: Please ignore the error about libvcmi.so, just recompile
ABIs targetted by application: Building with NDK r7 or newer
Building with NDK r6b
Building with NDK r5c or newer - internal STLPort disabled
armeabi
Device API Level: 10
Device CPU ABI: armeabi
Compatible device ABI: armeabi
Found debuggable flag: true
Found device gdbserver: /data/data/com.frogatto/lib/gdbserver
jni/../jni/vcmi/Android.mk:9: Please ignore the error about libvcmi.so, just recompile
Using gdb setup init: Building with NDK r7 or newer
Building with NDK r6b
Building with NDK r5c or newer - internal STLPort disabled
jni/../libs/armeabi/gdb.setup
jni/../jni/vcmi/Android.mk:9: Please ignore the error about libvcmi.so, just recompile
Using toolchain prefix: Building with NDK r7 or newer
Building with NDK r6b
Building with NDK r5c or newer - internal STLPort disabled
/home/hagabaka/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-
jni/../jni/vcmi/Android.mk:9: Please ignore the error about libvcmi.so, just recompile
Using app out directory: Building with NDK r7 or newer
Building with NDK r6b
Building with NDK r5c or newer - internal STLPort disabled
./obj/local/armeabi
Found data directory: '/data/data/com.frogatto'
Found first launchable activity: .MainActivity
Launching activity: com.frogatto/.MainActivity
## COMMAND: /opt/android-sdk/platform-tools/adb shell am start -n com.frogatto/.MainActivity
Starting: Intent { cmp=com.frogatto/.MainActivity }
## COMMAND: /opt/android-sdk/platform-tools/adb shell sleep 2
Found running PID: 2966
Launched gdbserver succesfully.
Setup network redirection
## COMMAND: /opt/android-sdk/platform-tools/adb shell run-as com.frogatto lib/gdbserver +debug-socket --attach 2966
## COMMAND: /opt/android-sdk/platform-tools/adb forward tcp:5039 localfilesystem:/data/data/com.frogatto/debug-socket
## COMMAND: /opt/android-sdk/platform-tools/adb pull /system/bin/app_process Building
Cannot attach to process 2966: Operation not permitted (1)
70 KB/s (5664 bytes in 0.078s)
Pulled app_process from device/emulator.
## COMMAND: /opt/android-sdk/platform-tools/adb pull /system/lib/libc.so Building
2313 KB/s (273900 bytes in 0.115s)
Pulled libc.so from device/emulator.
cp: target `./obj/local/armeabi/gdb.setup' is not a directory
/home/hagabaka/android-ndk-r7/ndk-gdb: line 639: Building with NDK r7 or newer
Building with NDK r6b
Building with NDK r5c or newer - internal STLPort disabled
./obj/local/armeabi/gdb.setup: No such file or directory
/home/hagabaka/android-ndk-r7/ndk-gdb: line 640: Building with NDK r7 or newer
Building with NDK r6b
Building with NDK r5c or newer - internal STLPort disabled
./obj/local/armeabi/gdb.setup: No such file or directory
/home/hagabaka/android-ndk-r7/ndk-gdb: line 644: Building: command not found

So the debugger quits on my computer before the app even gets to the point where it quits.

There's no backtrace in adb logcat, I think the only relevant output is here somewhere, but I can send a full log if it helps.
Code: Select all
W/AudioFlinger(   84): write blocked for 165 msecs, 14 delayed writes, thread 0xd018
V/DATA    (  214): [DCT] onDataCallListChanged:
V/DATA    (  214): [DCT] ---dc state list---
V/DATA    (  214): [DCT] DataCallState: { cid: 1, active: 1, type: null, apn: null, address: null }
V/DATA    (  214): [DCT] ---dc list---
V/DATA    (  214): [DCT] cid = -1, state = DcActiveState, ipv = IPV4, ipaddress = 21.48.6.25, gw=, dns=[68.28.137.132, 68.28.138.132]
D/BatteryService(  128): updateBattery level:100 scale:100 status:5 health:2 present:true voltage: 4156 temperature: 256 technology: Li-ion AC powered:false USB powered:true icon:17302170
I/NotificationService(  128): New BatteryHealth : 2Old BatteryHealth : 2
D/StatusBarPolicy(  196): updateBattery level=100 plugged=true mBatteryPlugged=true mBatteryLevel=100 mBatteryFirst=false
I/StatusBarPolicy(  196): BAT. status:5 health:2
V/AudioPolicyManager(   84): stopOutput() output 1, stream 3, session 30
V/AudioPolicyManager(   84): changeRefCount() stream 3, count 0
V/AudioPolicyManager(   84): getNewDevice() selected device 0
V/AudioPolicyManager(   84): setOutputDevice() output 1 device 0 delayMs 0
V/AudioPolicyManager(   84): setOutputDevice() setting same device 0 or null device for output 1
V/AudioPolicyManager(   84): releaseOutput() 1
I/ActivityManager(  128): Process com.frogatto (pid 3188) has died.
I/WindowManager(  128): WIN DEATH: Window{408667a8 com.frogatto/com.frogatto.MainActivity paused=false}
I/WindowManager(  128): WIN DEATH: Window{407acba0 SurfaceView paused=false}


The app code is at https://github.com/frogatto/frogatto/tree/android , I realize there will probably need to be more changes for it to work, but I was hoping to get some error messages to point me toward what to change...

Also even though project/AndroidManifest.xml says android:installLocation="preferExternal", adb tries to install it into internal storage and fails for me because there's insufficient storage. I had to use adb install -s to make it install ot SD card.
hagabaka
Freshman
Freshman
 
Posts: 5
Joined: Wed Dec 21, 2011 1:50 am

Re: SDL port for Android SDK/NDK 1.6

Postby lmak » Fri Dec 23, 2011 11:09 am

Ah yes, thanks pelya.

I was just looking at SDL_ANDROID_GetScreenKeyboardTextInput()-function. Good to know that there is also a non-blocking call.

Currently I'm using 1.2 so I guess I'll have to stick with the single key UP/DOWN events then.

Happy holidays!
lmak
Junior Developer
Junior Developer
 
Posts: 11
Joined: Thu Jan 20, 2011 7:16 pm

Top

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Fri Dec 23, 2011 5:03 pm

I've fixed GFX problems in Frogatto - they were caused by on-screen keyboard messing up OpenGL state. Since you've got your own on-screen controls in iPhone port you might wish to use them instead of SDL built-in on-screen keyboard, I've updated the readme with instructions.
Here's .apk file that works, here's the patch against Frogatto repository.
It still crashes whenever I'm trying to leave the house in the game, and also it won't refresh textures when I'm putting the app to background via Home key and restoring it back - SDL sends SDL_VIDEORESIZE event when that happens, and I'm calling graphics::set_video_mode(), but that's not enough - the texture::ID::build_id() should re-load the texture from a disk, not rely on the texture::ID::unbuild_id() which will not work on Android. So I've commented out clearing SDL surface inside texture::ID::build_id() - it will store the surface both in OpenGL texture memory and in SDL surface (watch out memory usage!), but it will correctly reinit textures when restored from background.

BTW I've also fixed ndk-gdb not working.
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Re: SDL port for Android SDK/NDK 1.6

Postby hagabaka » Sat Dec 24, 2011 3:29 am

Thanks a lot for your help so far. However I tried the .apk and building from with your patch, and both still quit before displaying the game menu. Here's adb logcat output:
Code: Select all
I/System.out( 3188): libSDL: Initializing video and SDL application
V/SDL     ( 3188): GLSurfaceView_SDL::EglHelper::start(): creating GL context
V/SDL     ( 3188): GL config 0: R5G6B5A0 depth 0 stencil 0 type 7 (GLES GLES2 OPENVG) caveat none nr 0 pos 17
V/SDL     ( 3188): GL config 1: R5G6B5A0 depth 16 stencil 0 type 7 (GLES GLES2 OPENVG) caveat none nr 0 pos 22
V/SDL     ( 3188): GL config 2: R5G6B5A0 depth 24 stencil 8 type 7 (GLES GLES2 OPENVG) caveat none nr 0 pos 21
V/SDL     ( 3188): GL config 3: R5G6B5A0 depth 0 stencil 0 type 7 (GLES GLES2 OPENVG) caveat non-conformant nr 0 pos 18
V/SDL     ( 3188): GL config 4: R5G6B5A0 depth 16 stencil 0 type 7 (GLES GLES2 OPENVG) caveat non-conformant nr 0 pos 23
V/SDL     ( 3188): GL config 5: R5G6B5A0 depth 24 stencil 8 type 7 (GLES GLES2 OPENVG) caveat non-conformant nr 0 pos 22
V/SDL     ( 3188): GL config 6: R5G6B5A0 depth 0 stencil 0 type 7 (GLES GLES2 OPENVG) caveat none nr 0 pos 17
V/SDL     ( 3188): GL config 7: R5G6B5A0 depth 16 stencil 0 type 7 (GLES GLES2 OPENVG) caveat none nr 0 pos 22
V/SDL     ( 3188): GL config 8: R5G6B5A0 depth 24 stencil 8 type 7 (GLES GLES2 OPENVG) caveat none nr 0 pos 21
V/SDL     ( 3188): GL config 9: R8G8B8A8 depth 0 stencil 0 type 7 (GLES GLES2 OPENVG) caveat none nr 0 pos 1
V/SDL     ( 3188): GL config 10: R8G8B8A0 depth 0 stencil 0 type 7 (GLES GLES2 OPENVG) caveat none nr 0 pos 9
V/SDL     ( 3188): GL config 11: R8G8B8A8 depth 16 stencil 0 type 7 (GLES GLES2 OPENVG) caveat none nr 0 pos 6
V/SDL     ( 3188): GL config 12: R8G8B8A0 depth 16 stencil 0 type 7 (GLES GLES2 OPENVG) caveat none nr 0 pos 14
V/SDL     ( 3188): GL config 13: R8G8B8A8 depth 24 stencil 8 type 7 (GLES GLES2 OPENVG) caveat none nr 0 pos 5
V/SDL     ( 3188): GL config 14: R8G8B8A0 depth 24 stencil 8 type 7 (GLES GLES2 OPENVG) caveat none nr 0 pos 13
V/SDL     ( 3188): GL config 15: R8G8B8A8 depth 0 stencil 0 type 7 (GLES GLES2 OPENVG) caveat non-conformant nr 0 pos 2
V/SDL     ( 3188): GL config 16: R8G8B8A0 depth 0 stencil 0 type 7 (GLES GLES2 OPENVG) caveat non-conformant nr 0 pos 10
V/SDL     ( 3188): GL config 17: R8G8B8A8 depth 16 stencil 0 type 7 (GLES GLES2 OPENVG) caveat non-conformant nr 0 pos 7
V/SDL     ( 3188): GL config 18: R8G8B8A0 depth 16 stencil 0 type 7 (GLES GLES2 OPENVG) caveat non-conformant nr 0 pos 15
V/SDL     ( 3188): GL config 19: R8G8B8A8 depth 24 stencil 8 type 7 (GLES GLES2 OPENVG) caveat non-conformant nr 0 pos 6
V/SDL     ( 3188): GL config 20: R8G8B8A0 depth 24 stencil 8 type 7 (GLES GLES2 OPENVG) caveat non-conformant nr 0 pos 14
V/SDL     ( 3188): GL config 21: R8G8B8A8 depth 0 stencil 0 type 7 (GLES GLES2 OPENVG) caveat none nr 0 pos 1
V/SDL     ( 3188): GL config 22: R8G8B8A0 depth 0 stencil 0 type 7 (GLES GLES2 OPENVG) caveat none nr 0 pos 9
V/SDL     ( 3188): GL config 23: R8G8B8A8 depth 16 stencil 0 type 7 (GLES GLES2 OPENVG) caveat none nr 0 pos 6
V/SDL     ( 3188): GL config 24: R8G8B8A0 depth 16 stencil 0 type 7 (GLES GLES2 OPENVG) caveat none nr 0 pos 14
V/SDL     ( 3188): GL config 25: R8G8B8A8 depth 24 stencil 8 type 7 (GLES GLES2 OPENVG) caveat none nr 0 pos 5
V/SDL     ( 3188): GL config 26: R8G8B8A0 depth 24 stencil 8 type 7 (GLES GLES2 OPENVG) caveat none nr 0 pos 13
V/SDL     ( 3188): GL config 27: R5G6B5A0 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 21
V/SDL     ( 3188): GL config 28: R5G6B5A0 depth 16 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 26
V/SDL     ( 3188): GL config 29: R8G8B8A0 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 13
V/SDL     ( 3188): GL config 30: R8G8B8A0 depth 16 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 18
V/SDL     ( 3188): GL config 31: R8G8B8A8 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 5
V/SDL     ( 3188): GL config 32: R8G8B8A8 depth 16 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 10
V/SDL     ( 3188): GL config 33: R0G0B0A8 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 29
V/SDL     ( 3188): GL config 34: R0G0B0A8 depth 16 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 34
V/SDL     ( 3188): GLSurfaceView_SDL::EGLConfigChooser::chooseConfig(): selected 9: R8G8B8A8 depth 0 stencil 0 type 7 (GLES GLES2 OPENVG) caveat none nr 0 pos 1
V/SDL     ( 3188): GLSurfaceView_SDL::EglHelper::createSurface(): creating GL context
I/System.out( 3188): libSDL: DemoRenderer.onSurfaceCreated(): paused false mFirstTimeStart true
I/System.out( 3188): libSDL: DemoRenderer.onSurfaceChanged(): paused false mFirstTimeStart false
I/libSDL  ( 3188): Physical screen resolution is 480x320, virtual screen 480x320
I/System.out( 3188): libSDL: DrawLogo
I/System.out( 3188): libSDL: setting envvar LANGUAGE to 'en_US'
I/System.out( 3188): libSDL: accelerometer start required: false
I/libSDL  ( 3188): Changing curdir to "/mnt/sdcard/app-data/com.frogatto"
I/libSDL  ( 3188): Calling SDL_main("sdl")
I/libSDL  ( 3188): param 0 = "sdl"
I/libSDL  ( 3188): SDL_SetVideoMode(): application requested mode 800x600 OpenGL 2 HW 0 BPP 32
I/libSDL  ( 3188): ANDROIDAUD_OpenAudio(): app requested audio bytespersample 2 freq 44100 channels 2 samples 1024
V/AudioPolicyManager(   84): getDeviceForStrategy() from cache strategy 0, device 2
V/AudioPolicyManager(   84): getOutput() stream 3, samplingRate 0, format 0, channels c, flags 0
V/AudioPolicyManager(   84): startOutput() output 1, stream 3, session 1900
V/AudioPolicyManager(   84): changeRefCount() stream 3, count 1
V/AudioPolicyManager(   84): getDeviceForStrategy() from cache strategy 0, device 2
V/AudioPolicyManager(   84): getNewDevice() selected device 2
V/AudioPolicyManager(   84): setOutputDevice() output 1 device 2 delayMs 0
V/AudioPolicyManager(   84): setOutputDevice() setting same device 2 or null device for output 1
I/libSDL  ( 3188): ANDROIDAUD_OpenAudio(): app opened audio bytespersample 2 freq 44100 channels 2 bufsize 4096
I/libSDL  ( 3188): SDL_Mixer: Timidity: cannot find timidity.cfg, MIDI support disabled
V/AudioHardwareMSM72XX(   84): open driver
V/AudioHardwareMSM72XX(   84): get config
V/AudioHardwareMSM72XX(   84): set config
V/AudioHardwareMSM72XX(   84): buffer_size: 4800
V/AudioHardwareMSM72XX(   84): buffer_count: 2
V/AudioHardwareMSM72XX(   84): channel_count: 2
V/AudioHardwareMSM72XX(   84): sample_rate: 44100
E/libSDL  ( 3188): ERROR: Couldn't open ./images/splash.jpg
W/AudioFlinger(   84): write blocked for 164 msecs, 253 delayed writes, thread 0xd018
V/AudioPolicyManager(   84): stopOutput() output 1, stream 3, session 1900
V/AudioPolicyManager(   84): changeRefCount() stream 3, count 0
V/AudioPolicyManager(   84): getNewDevice() selected device 0
V/AudioPolicyManager(   84): setOutputDevice() output 1 device 0 delayMs 0
V/AudioPolicyManager(   84): setOutputDevice() setting same device 0 or null device for output 1
V/AudioPolicyManager(   84): releaseOutput() 1
I/ActivityManager(  128): Process com.frogatto (pid 3188) has died.
I/WindowManager(  128): WIN DEATH: Window{407a9f18 com.frogatto/com.frogatto.MainActivity paused=false}
E/InputDispatcher(  128): Received spurious receive callback for unknown input channel.  fd=274, events=0x8
I/WindowManager(  128): WIN DEATH: Window{40805ea0 SurfaceView paused=false}


And ndk-gdb still doesn't work for me:
Code: Select all
Android NDK installation path: /home/hagabaka/android-ndk-r7
Using default adb command: /opt/android-sdk/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.29
Using final ADB command: '/opt/android-sdk/platform-tools/adb'
Using auto-detected project path: .
Found package name: com.frogatto
nm: jni/../jni/application/../../obj/local/armeabi/libc.so: no symbols
ABIs targetted by application: armeabi
Device API Level: 10
Device CPU ABI: armeabi
Compatible device ABI: armeabi
Found debuggable flag: true
Found device gdbserver: /data/data/com.frogatto/lib/gdbserver
nm: jni/../jni/application/../../obj/local/armeabi/libc.so: no symbols
Using gdb setup init: jni/../libs/armeabi/gdb.setup
nm: jni/../jni/application/../../obj/local/armeabi/libc.so: no symbols
Using toolchain prefix: /home/hagabaka/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-
nm: jni/../jni/application/../../obj/local/armeabi/libc.so: no symbols
Using app out directory: ./obj/local/armeabi
Found data directory: '/data/data/com.frogatto'
Found first launchable activity: .MainActivity
Launching activity: com.frogatto/.MainActivity
## COMMAND: /opt/android-sdk/platform-tools/adb shell am start -n com.frogatto/.MainActivity
Starting: Intent { cmp=com.frogatto/.MainActivity }
## COMMAND: /opt/android-sdk/platform-tools/adb shell sleep 2
Found running PID: 3620
Launched gdbserver succesfully.
## COMMAND: /opt/android-sdk/platform-tools/adb shell run-as com.frogatto lib/gdbserver +debug-socket --attach 3620
Setup network redirection
## COMMAND: /opt/android-sdk/platform-tools/adb forward tcp:5039 localfilesystem:/data/data/com.frogatto/debug-socket
## COMMAND: /opt/android-sdk/platform-tools/adb pull /system/bin/app_process ./obj/local/armeabi/app_process
Cannot attach to process 3620: Operation not permitted (1)
71 KB/s (5664 bytes in 0.076s)
Pulled app_process from device/emulator.
## COMMAND: /opt/android-sdk/platform-tools/adb pull /system/lib/libc.so ./obj/local/armeabi/libc.so
2186 KB/s (273900 bytes in 0.122s)
Pulled libc.so from device/emulator.
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-elf-linux".
Warning: /home/hagabaka/commandergenius/project/jni/../jni/mikmod/jni/../jni/mikmod: No such file or directory.
Warning: /home/hagabaka/commandergenius/project/jni/../jni/sdl_sound/timidity: No such file or directory.
(no debugging symbols found)
/home/hagabaka/commandergenius/project/obj/local/armeabi/gdb.setup:4: Error in sourced command file:
Remote communication error: Connection reset by peer.
hagabaka
Freshman
Freshman
 
Posts: 5
Joined: Wed Dec 21, 2011 1:50 am

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Sat Dec 24, 2011 10:27 am

What device do you have? Does it have Android 2.3? Could you try to run ndk-gdb from the official NDK r7? Yesterday ndk-gdb worked for me without problems.

Also, what kind of data files you are using? Did you download the 300 Mb archive with data, when my .apk file asked you at startup? Could you please try to remove application and install it again in a clean environment?

Edit: I confirm it crashes on the emulator, just after the loading screen, I'm going to debug it a bit.
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Re: SDL port for Android SDK/NDK 1.6

Postby hagabaka » Sat Dec 24, 2011 5:49 pm

I have a rooted Samsung Galaxy Prevail, running Android 2.35. I also tried running it on emulator with target android-9 (2.3.1) and it has the same behavior. I did let the game finish downloading the 300MB data. I also tried uninstalling it, removing /sdcard/app-data/com.frogatto and reinstalling, and the same thing happens. I was using official sdk 7 already, but I also tried crystax r7 and debugger fails at the same point.
hagabaka
Freshman
Freshman
 
Posts: 5
Joined: Wed Dec 21, 2011 1:50 am

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Mon Dec 26, 2011 4:21 pm

I've found why it crashes:
I/SDL-app ( 581): jni/../jni/application/frogatto/src/formula.cpp:1745: TEST CHECK FAILED: (formula("0.005").execute().string_cast()) == ("0.005"): formula("0.005").execute().string_cast(): 0.000; "0.005": 0.005
I/SDL-app ( 581): TEST formula_decimal FAILED!!


Disabling the tests did not solve the issue - it still crashes while loading menu. That most probably means you have pointer alignment problems - adding the magic incantation "-Wstrict-aliasing -Wcast-align -Wpointer-arith -Waddress" to the compiler flags shows a lot of warnings, mostly hidden inside Boost headers (the only other project that uses Boost library is VCMI, and it's extremely buggy, though I have no idea whether it's VCMI or Boost fault).

That to be said, my HTC Evo seems to be more forgiving to such errors - it can run the first level of the game.
New diff with debugging redirected to logcat, you'll also need to update SDL repository for it to compile.
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Re: SDL port for Android SDK/NDK 1.6

Postby confi » Tue Dec 27, 2011 11:23 pm

Hello,

I tried to build ballfield like described in the readme for your port which looks very interesting.

A lot of libs compiled properly but then I get an undefined reference somewhere in SDL_sound :

Code: Select all
./obj/local/armeabi/objs-debug/sdl-1.2/src/audio/SDL_audio.o: In function `SDL_AudioInit':
/home/gilles/Development/pelyaSDL/project/jni/../jni/sdl-1.2/src/audio/SDL_audio.c:380: undefined reference to `ANDROIDAUD_bootstrap'
./obj/local/armeabi/objs-debug/sdl-1.2/src/audio/SDL_audio.o:(.data.rel.ro+0x0): undefined reference to `ANDROIDAUD_bootstrap'
./obj/local/armeabi/objs-debug/sdl-1.2/src/video/android/SDL_androidvideo.o: In function `appRestoredCallbackDefault':
/home/gilles/Development/pelyaSDL/project/jni/../jni/sdl-1.2/src/video/android/SDL_androidvideo.c:82: undefined reference to `SDL_ANDROID_ResumeAudioPlayback'
./obj/local/armeabi/objs-debug/sdl-1.2/src/video/android/SDL_androidvideo.o: In function `appPutToBackgroundCallbackDefault':
/home/gilles/Development/pelyaSDL/project/jni/../jni/sdl-1.2/src/video/android/SDL_androidvideo.c:78: undefined reference to `SDL_ANDROID_PauseAudioPlayback'
collect2: ld returned 1 exit status
make: *** [obj/local/armeabi/libsdl-1.2.so] Error 1


I use the last version of your source on git for the SDL port on ubuntu with android12 and ndk r7

any idea on what I got wrong?
confi
Junior Developer
Junior Developer
 
Posts: 15
Joined: Tue Dec 27, 2011 11:12 pm

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Wed Dec 28, 2011 10:57 am

Seems like the file project/jni/sdl-1.2/src/audio/android/SDL_androidaudio.c did not get compiled, which is a mystery. It should be a symlink to the sdl-1.3 directory, and I've used symlinks inside my repository since beginning without problems, especially on Ubuntu. I've also got NDK r7 and recent SDK, and I've just tested the compilation to be sure.

Try to remove project/obj directory and recompile (run "./ChangeAppSettings.sh -a ; ./build.sh"). If that won't help try to replace symlink project/jni/sdl-1.2/src/audio/android/SDL_androidaudio.c with the actual file. Try removing "-j4" parameter to "make" command inside build.sh, so it won't parallelize the compilation jobs.
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Re: SDL port for Android SDK/NDK 1.6

Postby george.guo » Wed Dec 28, 2011 12:49 pm

Pelya,

My application can basically run with your SDL port. Thanks a lot for your previous support.
My application also need camera input interface, can you share any idea about how to open camera in Android NDK?

Thanks.
george.guo
Freshman
Freshman
 
Posts: 5
Joined: Mon Dec 12, 2011 2:44 pm

Re: SDL port for Android SDK/NDK 1.6

Postby confi » Wed Dec 28, 2011 1:42 pm

Thanks for your help pelya, I managed to solve my issue, fyi :
SDL_androidaudio.c was entirely missing from my SDL 1-3 src folder, which was a bit tricky to see considering it was used behind a symlink as you explained, so I tried re-unzipping the repository from git and this file was still missing, I noticed that unzip was outputting some files directly in the standard output while decompressing, and these files were then missing in the unpacked folder, very strange : something might be wrong in the .zip version of the repository on git or in my setup (I used the latest version of unzip from apt..)

I downloaded the .tar.gz version and everything worked fine, I am very excited to use SDL on android thanks to your port, cool stuff :)
confi
Junior Developer
Junior Developer
 
Posts: 15
Joined: Tue Dec 27, 2011 11:12 pm

Top
PreviousNext

Return to Code Snippets for Android

Who is online

Users browsing this forum: No registered users and 3 guests