Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Android: No handler for bitmap extensions .png

This thread is locked; no one can reply to it. rss feed Print
Android: No handler for bitmap extensions .png
partyk1d24
Member #15,242
July 2013

Any idea here....

I/allegro (14621): bitmap W 14634: bitmap_io.c:243 al_load_bitmap_flags [ 0.42207] No handler for bitmap extensions .png - therefore not trying to load //sdcard//.tetris//images//loading_game_bg.png.

loading_background = al_load_bitmap(LoadingGameBackground);

Matthew Leverton
Supreme Loser
January 1999
avatar

Call al_init_image_addon() prior to loading a bitmap.

partyk1d24
Member #15,242
July 2013

Ok will try but seems to happen on example too....

I/allegro (14802): bitmap W 14816: bitmap_io.c:243 al_load_bitmap_flags [ 0.25266] No handler for bitmap extensions .png - therefore not trying to load alexlogo.png.
I/allegro (14802): main D 14816: main.c:88 main [ 0.25281] failed to load alexlogo.png

Actually I was...

LOGI("Initializing add ons...");
        al_init_image_addon();

Let me know if checking in my version (different Android.mk) would help you. I just wanted my .sos locally not in my toolchain.

Trent Gamblin
Member #261
April 2000
avatar

You need to build libpng for Android with the ndk compiler and put it where Allegro can find it. Easiest is to put it in android-toolchain/sysroot/usr/(lib|include), but you can also pass cmake -DPNG_LIBRARY= and -DPNG_INCLUDE_DIR=. If you want to try out the native image loader on Android (which was broken but I committed a fix that may have fixed it) then let me know, I'll set it back up in git. It should "seem" to work at first, but before after loading a lot of images (during a long gameplay of a few hours) it would inevitably crash.

partyk1d24
Member #15,242
July 2013

So when you say use libpng would I have to do anything besides including the library? Would I have to rebuild Allegro after?

With the native loader what does that mean? Loaded entirely within native? Is that how the example application is doing it?

Also would it work as is with a bmp? Yup seems fine as a bmp I will play around with it.

Trent Gamblin
Member #261
April 2000
avatar

For libpng you'd have to build libpng and recompile Allegro.

The native loader actually uses Java, it's called native because it's "native to Android" but doesn't require any extra libraries. You'd also have to rebuild Allegro.

BMP, PCX and TGA should all work still since they're built-in to Allegro with no extra dependencies.

partyk1d24
Member #15,242
July 2013

Ok I finally got around to playing with the libpng side of this...

Tried this...

ccmake .. -DANDROID_NDK_TOOLCHAIN_ROOT=$TC -DWANT_ANDROID=on  -DWANT_EXAMPLES=OFF -DWANT_DEMO=OFF -DCMAKE_BUILD_TYPE=Debug -DPNG_LIBRARY= /Users/me/Development/AOSP/external/libpng/libs/armeabi/libz.so  -DPNG_INCLUDE_DIR=/Users/me/Development/AOSP/external/libpng

CMake Error: The source directory "/Users/me/Development/AOSP/external/libpng/libs/armeabi/libpng.so" is a file, not a directory.
 Specify --help for usage, or press the help button on the CMake GUI.

So then I try....

ccmake .. -DANDROID_NDK_TOOLCHAIN_ROOT=$TC -DWANT_ANDROID=on  -DWANT_EXAMPLES=OFF -DWANT_DEMO=OFF -DCMAKE_BUILD_TYPE=Debug -DPNG_LIBRARY= /Users/me/Development/AOSP/external/libpng/libs/armeabi  -DPNG_INCLUDE_DIR=/Users/me/Development/AOSP/external/libpng

CMake Error: The source directory "/Users/me/Development/AOSP/external/libpng/libs/armeabi" does not appear to contain CMakeLists.txt.
 Specify --help for usage, or press the help button on the CMake GUI.

Any ideas what I am doing wrong?

OOOPS

Extra space dope :P

Ok But now

CMake Warning:
Manually-specified variables were not used by the project:

PNG_INCLUDE_DIR

And I don't see png anywhere in the install. It will take me some time to test but does it look right?

Go to: