Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » android: ex_ttf example not running

This thread is locked; no one can reply to it. rss feed Print
android: ex_ttf example not running
Pho75_
Member #12,377
November 2010

Hi all,

Trying to build and run allegro5 examples for android on ubuntu 21.04.
none of the examples with addon's that rely on allegro dependency libraries seem to work.

eg: ex_ttf.
Tested on motorola moto g5 plus running oreo 8.1.
It's crashing when I run the apk (see logcat below) with "allegro_ttf FAILED".

I tried compiling the allegro .so's myself
and I also tried substituting the precompiled .so's and includes folder from
https://allegro5.org/android/5.2.7.0/allegro_jni_includes.zip
this url, but both are giving the same error.

My script to build the android dependencies is below.

My first thought was the .so's for the addon dependencies also needed to be in the apk. But those .so's aren't in the precompiled binaries zip either, and there's no reference to them in allegro's grade_project.

What am I doing wrong?

Thanks,
Pho75.

adb logcat
==================
05-31 12:24:31.029  2745  5231 I ActivityManager: Start proc 21330:org.liballeg.ex_ttf/u0a246 for activity org.liballeg.ex_ttf/org.liballeg.app.MainActivity
05-31 12:24:31.029 21330 21330 E SchedPolicy: open of /dev/cpuctl/bg_non_interactive/tasks failed: No such file or directory
05-31 12:24:31.079 21330 21330 I zygote  : Late-enabling -Xcheck:jni
05-31 12:24:31.613 21330 21330 D loadLibrary: allegro-debug
05-31 12:24:31.618 21330 21330 D loadLibrary: allegro
05-31 12:24:31.620 21330 21330 D loadLibrary: allegro_primitives-debug
05-31 12:24:31.622 21330 21330 D loadLibrary: allegro_primitives
05-31 12:24:31.623 21330 21330 D loadLibrary: allegro_image-debug
05-31 12:24:31.625 21330 21330 D loadLibrary: allegro_image
05-31 12:24:31.627 21330 21330 D loadLibrary: allegro_font-debug
05-31 12:24:31.628 21330 21330 D loadLibrary: allegro_font
05-31 12:24:31.630 21330 21330 D loadLibrary: allegro_ttf-debug
05-31 12:24:31.632 21330 21330 D loadLibrary: allegro_ttf
05-31 12:24:31.635 21330 21330 D loadLibrary: allegro_ttf FAILED
05-31 12:24:31.635 21330 21330 D loadLibrary: allegro_audio-debug
05-31 12:24:31.637 21330 21330 D loadLibrary: allegro_audio
05-31 12:24:31.639 21330 21330 D loadLibrary: allegro_acodec-debug
05-31 12:24:31.641 21330 21330 D loadLibrary: allegro_acodec
05-31 12:24:31.644 21330 21330 D loadLibrary: allegro_color-debug
05-31 12:24:31.646 21330 21330 D loadLibrary: allegro_color
05-31 12:24:31.647 21330 21330 D loadLibrary: allegro_memfile-debug
05-31 12:24:31.649 21330 21330 D loadLibrary: allegro_memfile
05-31 12:24:31.651 21330 21330 D loadLibrary: allegro_physfs-debug
05-31 12:24:31.653 21330 21330 D loadLibrary: allegro_physfs
05-31 12:24:31.655 21330 21330 D loadLibrary: allegro_physfs FAILED
05-31 12:24:31.655 21330 21330 D loadLibrary: allegro_video-debug
05-31 12:24:31.657 21330 21330 D loadLibrary: allegro_video
05-31 12:24:31.659 21330 21330 D loadLibrary: allegro_video FAILED
05-31 12:24:31.662 21330 21330 D AllegroActivity: Number of input devices: 10
05-31 12:24:31.678 21330 21330 D AllegroActivity: onCreate
05-31 12:24:31.699 21330 21330 D AllegroActivity: Files Dir: /data/user/0/org.liballeg.ex_ttf/files
05-31 12:24:31.704 21330 21330 D AllegroActivity: External Storage Dir: /storage/emulated/0
05-31 12:24:31.706 21330 21330 D AllegroActivity: External Files Dir: /storage/emulated/0/Android/data/org.liballeg.ex_ttf/files
05-31 12:24:31.706 21330 21330 D AllegroActivity: external: avail = true writable = true
05-31 12:24:31.706 21330 21330 D AllegroActivity: sourceDir: /data/app/org.liballeg.ex_ttf-421L77sG0NCjVdM5kk9ZCA==/base.apk
05-31 12:24:31.706 21330 21330 D AllegroActivity: publicSourceDir: /data/app/org.liballeg.ex_ttf-421L77sG0NCjVdM5kk9ZCA==/base.apk
05-31 12:24:31.715 21330 21330 D AllegroActivity: before nativeOnCreate
05-31 12:24:31.723 21330 21330 D AllegroActivity: nativeOnCreate failed
05-31 12:24:31.874 21330 21330 D AllegroActivity: onDestroy
05-31 12:24:31.939  2745  4458 I ActivityManager: Process org.liballeg.ex_ttf (pid 21330) has died: cch  CEM 
05-31 12:24:31.939  2745  2796 W zygote  : kill(-21330, 9) failed: No such process
05-31 12:24:31.939  2745  2796 I zygote  : Successfully killed process cgroup uid 10246 pid 21330 in 0ms

apk contents
==================
build_android_armeabi-v7a$ unzip -l examples/ex_ttf.project/app/build/outputs/apk/debug/app-debug.apk
Archive:  examples/ex_ttf.project/app/build/outputs/apk/debug/app-debug.apk
  Length      Date    Time    Name
---------  ---------- -----   ----
     2228  1980-00-00 00:00   AndroidManifest.xml
     1203  1980-00-00 00:00   META-INF/CERT.RSA
     1615  1980-00-00 00:00   META-INF/CERT.SF
     1572  1980-00-00 00:00   META-INF/MANIFEST.MF
   622020  1980-00-00 00:00   assets/data/DejaVuSans.ttf
    36033  1980-00-00 00:00   assets/data/a4_font.fnt
      957  1980-00-00 00:00   assets/data/ex_ttf.ini
    55024  1980-00-00 00:00   classes.dex
  2870680  1980-00-00 00:00   lib/armeabi-v7a/liballegro.so
   166952  1980-00-00 00:00   lib/armeabi-v7a/liballegro_acodec.so
   334824  1980-00-00 00:00   lib/armeabi-v7a/liballegro_audio.so
   146652  1980-00-00 00:00   lib/armeabi-v7a/liballegro_color.so
   214816  1980-00-00 00:00   lib/armeabi-v7a/liballegro_font.so
   197380  1980-00-00 00:00   lib/armeabi-v7a/liballegro_image.so
     6404  1980-00-00 00:00   lib/armeabi-v7a/liballegro_main.so
   102640  1980-00-00 00:00   lib/armeabi-v7a/liballegro_memfile.so
    42948  1980-00-00 00:00   lib/armeabi-v7a/liballegro_physfs.so
   364880  1980-00-00 00:00   lib/armeabi-v7a/liballegro_primitives.so
   153672  1980-00-00 00:00   lib/armeabi-v7a/liballegro_ttf.so
   143948  1980-00-00 00:00   lib/armeabi-v7a/libnative-lib.so
      384  1980-00-00 00:00   resources.arsc
---------                     -------
  5466832                     21 files

deps folder:
==================
:~/src/allegro5/build_android_armeabi-v7a/deps$ find .
.
./bin
./bin/libpng16-config
./bin/brotli
./bin/png-fix-itxt
./bin/libpng-config
./bin/test_physfs
./bin/pngfix
./include
./include/physfs.h
./include/freetype2
./include/freetype2/freetype
./include/freetype2/freetype/ftsynth.h
./include/freetype2/freetype/ftimage.h
./include/freetype2/freetype/ftrender.h
./include/freetype2/freetype/ttnameid.h
./include/freetype2/freetype/fterrdef.h
./include/freetype2/freetype/freetype.h
./include/freetype2/freetype/fterrors.h
./include/freetype2/freetype/ftgzip.h
./include/freetype2/freetype/ftsizes.h
./include/freetype2/freetype/tttags.h
./include/freetype2/freetype/ftcid.h
./include/freetype2/freetype/ftgasp.h
./include/freetype2/freetype/ftcache.h
./include/freetype2/freetype/ftmac.h
./include/freetype2/freetype/ftadvanc.h
./include/freetype2/freetype/ftmm.h
./include/freetype2/freetype/ftcolor.h
./include/freetype2/freetype/ftbdf.h
./include/freetype2/freetype/ftparams.h
./include/freetype2/freetype/ftsnames.h
./include/freetype2/freetype/tttables.h
./include/freetype2/freetype/ftstroke.h
./include/freetype2/freetype/ftlzw.h
./include/freetype2/freetype/ftchapters.h
./include/freetype2/freetype/ftmodapi.h
./include/freetype2/freetype/fttypes.h
./include/freetype2/freetype/ftbitmap.h
./include/freetype2/freetype/ftfntfmt.h
./include/freetype2/freetype/ftlist.h
./include/freetype2/freetype/ftpfr.h
./include/freetype2/freetype/ftwinfnt.h
./include/freetype2/freetype/ftglyph.h
./include/freetype2/freetype/ftincrem.h
./include/freetype2/freetype/ftotval.h
./include/freetype2/freetype/ftsystem.h
./include/freetype2/freetype/ftgxval.h
./include/freetype2/freetype/ftdriver.h
./include/freetype2/freetype/config
./include/freetype2/freetype/config/mac-support.h
./include/freetype2/freetype/config/ftconfig.h
./include/freetype2/freetype/config/ftstdlib.h
./include/freetype2/freetype/config/ftmodule.h
./include/freetype2/freetype/config/ftoption.h
./include/freetype2/freetype/config/ftheader.h
./include/freetype2/freetype/config/public-macros.h
./include/freetype2/freetype/config/integer-types.h
./include/freetype2/freetype/ftbzip2.h
./include/freetype2/freetype/fttrigon.h
./include/freetype2/freetype/ftmoderr.h
./include/freetype2/freetype/t1tables.h
./include/freetype2/freetype/ftbbox.h
./include/freetype2/freetype/ftoutln.h
./include/freetype2/freetype/ftlcdfil.h
./include/freetype2/ft2build.h
./include/brotli
./include/brotli/types.h
./include/brotli/encode.h
./include/brotli/decode.h
./include/brotli/port.h
./include/harfbuzz
./include/harfbuzz/hb.h
./include/harfbuzz/hb-ot-name.h
./include/harfbuzz/hb-ot-shape.h
./include/harfbuzz/hb-aat-layout.h
./include/harfbuzz/hb-ot-layout.h
./include/harfbuzz/hb-map.h
./include/harfbuzz/hb-aat.h
./include/harfbuzz/hb-buffer.h
./include/harfbuzz/hb-ot-color.h
./include/harfbuzz/hb-ot-meta.h
./include/harfbuzz/hb-blob.h
./include/harfbuzz/hb-shape-plan.h
./include/harfbuzz/hb-face.h
./include/harfbuzz/hb-unicode.h
./include/harfbuzz/hb-ot-var.h
./include/harfbuzz/hb-ot-metrics.h
./include/harfbuzz/hb-draw.h
./include/harfbuzz/hb-shape.h
./include/harfbuzz/hb-version.h
./include/harfbuzz/hb-ot.h
./include/harfbuzz/hb-ot-font.h
./include/harfbuzz/hb-ot-deprecated.h
./include/harfbuzz/hb-font.h
./include/harfbuzz/hb-common.h
./include/harfbuzz/hb-deprecated.h
./include/harfbuzz/hb-ot-math.h
./include/harfbuzz/hb-style.h
./include/harfbuzz/hb-set.h
./include/allegro5
./include/allegro5/timer.h
./include/allegro5/fixed.h
./include/allegro5/internal
./include/allegro5/internal/alconfig.h
./include/allegro5/transformations.h
./include/allegro5/inline
./include/allegro5/inline/fmaths.inl
./include/allegro5/allegro_font.h
./include/allegro5/fmaths.h
./include/allegro5/blender.h
./include/allegro5/allegro_ttf.h
./include/allegro5/joystick.h
./include/allegro5/base.h
./include/allegro5/path.h
./include/allegro5/threads.h
./include/allegro5/cpu.h
./include/allegro5/drawing.h
./include/allegro5/allegro_direct3d.h
./include/allegro5/error.h
./include/allegro5/bitmap_draw.h
./include/allegro5/allegro_acodec.h
./include/allegro5/mouse_cursor.h
./include/allegro5/fshook.h
./include/allegro5/config.h
./include/allegro5/display.h
./include/allegro5/altime.h
./include/allegro5/color.h
./include/allegro5/keyboard.h
./include/allegro5/render_state.h
./include/allegro5/tls.h
./include/allegro5/debug.h
./include/allegro5/allegro.h
./include/allegro5/file.h
./include/allegro5/clipboard.h
./include/allegro5/allegro_android.h
./include/allegro5/allegro_audio.h
./include/allegro5/allegro_opengl.h
./include/allegro5/allegro_image.h
./include/allegro5/opengl
./include/allegro5/opengl/GLext
./include/allegro5/opengl/GLext/glx_ext_api.h
./include/allegro5/opengl/GLext/gl_ext_api.h
./include/allegro5/opengl/GLext/glx_ext_defs.h
./include/allegro5/opengl/GLext/wgl_ext_alias.h
./include/allegro5/opengl/GLext/gl_ext_defs.h
./include/allegro5/opengl/GLext/gl_ext_alias.h
./include/allegro5/opengl/GLext/wgl_ext_defs.h
./include/allegro5/opengl/GLext/glx_ext_list.h
./include/allegro5/opengl/GLext/wgl_ext_api.h
./include/allegro5/opengl/GLext/gl_ext_list.h
./include/allegro5/opengl/GLext/wgl_ext_list.h
./include/allegro5/opengl/GLext/glx_ext_alias.h
./include/allegro5/opengl/gl_ext.h
./include/allegro5/allegro_color.h
./include/allegro5/bitmap.h
./include/allegro5/allegro5.h
./include/allegro5/allegro_physfs.h
./include/allegro5/memory.h
./include/allegro5/fullscreen_mode.h
./include/allegro5/allegro_primitives.h
./include/allegro5/alcompat.h
./include/allegro5/touch_input.h
./include/allegro5/platform
./include/allegro5/platform/alwatcom.h
./include/allegro5/platform/alandroid.h
./include/allegro5/platform/alunix.h
./include/allegro5/platform/aliphone.h
./include/allegro5/platform/alosxcfg.h
./include/allegro5/platform/albcc32.h
./include/allegro5/platform/alraspberrypicfg.h
./include/allegro5/platform/alraspberrypi.h
./include/allegro5/platform/almngw32.h
./include/allegro5/platform/alucfg.h
./include/allegro5/platform/allegro_sdl_config.h
./include/allegro5/platform/almsvc.h
./include/allegro5/platform/alandroidcfg.h
./include/allegro5/platform/alwin.h
./include/allegro5/platform/aliphonecfg.h
./include/allegro5/platform/alplatf.h
./include/allegro5/platform/alosx.h
./include/allegro5/platform/astdbool.h
./include/allegro5/platform/astdint.h
./include/allegro5/system.h
./include/allegro5/utf8.h
./include/allegro5/monitor.h
./include/allegro5/events.h
./include/allegro5/bitmap_io.h
./include/allegro5/bitmap_lock.h
./include/allegro5/keycodes.h
./include/allegro5/shader.h
./include/allegro5/haptic.h
./include/allegro5/allegro_memfile.h
./include/allegro5/mouse.h
./include/pnglibconf.h
./include/libpng16
./include/libpng16/pnglibconf.h
./include/libpng16/png.h
./include/libpng16/pngconf.h
./include/png.h
./include/pngconf.h
./share
./share/aclocal
./share/aclocal/freetype2.m4
./share/man
./share/man/man3
./share/man/man3/libpngpf.3
./share/man/man3/libpng.3
./share/man/man5
./share/man/man5/png.5
./lib
./lib/libbrotlienc.so.1
./lib/libphysfs.a
./lib/liballegro_main.so
./lib/libbrotlicommon-static.a
./lib/libpng16.la
./lib/liballegro_acodec.so
./lib/libbrotlienc.so.1.0.9
./lib/libbrotlidec.so.1.0.9
./lib/libbrotlienc.so
./lib/libpng16.so
./lib/liballegro_font.so
./lib/cmake
./lib/cmake/harfbuzz
./lib/cmake/harfbuzz/harfbuzzConfig-noconfig.cmake
./lib/cmake/harfbuzz/harfbuzzConfig.cmake
./lib/libbrotlicommon.so
./lib/libfreetype.la
./lib/liballegro_ttf.so
./lib/liballegro_memfile.so
./lib/libpng.so
./lib/libbrotlidec.so.1
./lib/libfreetype.a
./lib/libfreetype.so
./lib/pkgconfig
./lib/pkgconfig/physfs.pc
./lib/pkgconfig/libpng.pc
./lib/pkgconfig/libbrotlicommon.pc
./lib/pkgconfig/libpng16.pc
./lib/pkgconfig/libbrotlienc.pc
./lib/pkgconfig/freetype2.pc
./lib/pkgconfig/libbrotlidec.pc
./lib/libbrotlienc-static.a
./lib/libbrotlidec.so
./lib/libbrotlicommon.so.1.0.9
./lib/libphysfs.so.3.0.2
./lib/libbrotlicommon.so.1
./lib/libphysfs.so
./lib/liballegro_color.so
./lib/libpng.la
./lib/liballegro_physfs.so
./lib/liballegro.so
./lib/libphysfs.so.1
./lib/libpng16.a
./lib/libpng.a
./lib/liballegro_image.so
./lib/liballegro_audio.so
./lib/libbrotlidec-static.a
./lib/liballegro_primitives.so
./lib/libharfbuzz.a

#SelectExpand
1dependency build script. _BROKEN: DON'T USE_ 2================== 3#!/bin/bash 4set -x 5 6export ORIG_PWD=$PWD 7 8 9# atexit func 10function my_atexit { 11 cd $ORIG_PWD 12} 13 14trap my_atexit EXIT 15 16 17export ALLEGRO5_FOLDER=$HOME/src/allegro5 18export ANDROID_BUILD_FOLDER=$ALLEGRO5_FOLDER/build_android_armeabi-v7a 19 20#configure cross-compile 21export ABI=armeabi-v7a 22export HOST=arm-linux-androideabi 23export CHOST=armv7a-linux-androideabi 24export SDK=21 25export HOST_TAG=linux-x86_64 26export PREFIX=$ANDROID_BUILD_FOLDER/deps 27#export NDK=$HOME/Android/Sdk/ndk-bundle 28export NDK=~/Android/Sdk/ndk/21.1.6352462 29export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/$HOST_TAG 30export AR=$TOOLCHAIN/bin/$HOST-ar 31export AS=$TOOLCHAIN/bin/$HOST-as 32export CC=$TOOLCHAIN/bin/$CHOST$SDK-clang 33export CXX=$TOOLCHAIN/bin/$CHOST$SDK-clang++ 34export LD=$TOOLCHAIN/bin/$HOST-ld 35export RANLIB=$TOOLCHAIN/bin/$HOST-ranlib 36export STRIP=$TOOLCHAIN/bin/$HOST-strip 37 38 39## build PhysFS 40#cd $ALLEGRO5_FOLDER 41#cd physfs-3.0.2 42#mkdir build 43#cd build 44##./configure --host $HOST --prefix $PREFIX 45##make 46##make install 47#cmake .. -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX 48#make install 49 50 51# add include + lib folder to search path 52export CFLAGS="-I$PREFIX/include" 53export CXXFLAGS="-I$PREFIX/include" 54#export LDLAGS="-L$PREFIX/lib" 55export LD_LIBRARY_PATH="$PREFIX/lib" 56 57 58# build harfbuzz (freetype dependency) 59echo; echo 60echo =================== 61echo Building harfbuzz 62echo =================== 63echo 64cd $ALLEGRO5_FOLDER 65cd harfbuzz-2.8.1/ 66mkdir build 67cd build 68#cmake .. -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX 69cmake .. -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX -DBUILD_SHARED_LIBS=0 70make install 71 72 73#libpng 74echo; echo 75echo =================== 76echo Building libpng 77echo =================== 78echo 79cd $ALLEGRO5_FOLDER 80cd libpng-1.6.37 81./configure --host $HOST --prefix $PREFIX 82#./configure --host $HOST --prefix $PREFIX --disable-shared 83make install 84 85# brotli 1.0.9 PhysFS dependency 86echo; echo 87echo =================== 88echo Building brotli 89echo =================== 90echo 91cd $ALLEGRO5_FOLDER 92cd brotli-1.0.9 93#./configure --host $HOST --prefix $PREFIX 94#./configure --host $HOST --prefix $PREFIX --disable-shared 95#make install 96#make clean 97##make lib 98##make install 99mkdir build 100cd build 101cmake .. -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX -DBROTLI_DISABLE_TESTS=1 102make install 103 104 105# build PhysFS 1.0.2 106echo; echo 107echo =================== 108echo Building PhysFS 109echo =================== 110echo 111cd $ALLEGRO5_FOLDER 112#cd physfs-1.0.2 113cd physfs-3.0.2 114#./configure --host $HOST --prefix $PREFIX 115##./configure --host $HOST --prefix $PREFIX --disable-shared 116mkdir build 117cd build 118cmake .. -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX 119make install 120 121 122# build Freetype 123echo; echo 124echo =================== 125echo Building Freetype 126echo =================== 127echo 128cd $ALLEGRO5_FOLDER 129cd freetype-2.10.4/ 130./configure --host $HOST --prefix $PREFIX 131#./configure --host $HOST --prefix $PREFIX --disable-shared 132CFLAGS="-I$PREFIX/include" make 133make install 134 135 136# FAILED ATTEMPT: delete all shared libraries so allegro5 will only use static libs 137#rm -f $PREFIX/lib/*.so 138#rm -f $PREFIX/lib/*.so.* 139 140exit 0 141

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Pho75_
Member #12,377
November 2010

Edgar:

freetype2 is in the build script (See bottom). Both the static and shared libs get created.
If freetype2 weren't present then allegro_ttf addon wouldn't have been built
and neither would ex_ttf apk, which depends on it.

I've updated the original post with the contents of the deps/ folder.
Thanks.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Pho75_
Member #12,377
November 2010

I recompiled with debug build and it looks like it's erroring because it can't find libfreetype.so, which is not in the apk.
If the dependencies are needed then why aren't they referenced in the gradle_project by default?
How do I get them in the apk?

$ adb logcat | grep 8778
06-02 07:05:04.512  2745  4458 I ActivityManager: Start proc 8778:org.liballeg.ex_ttf/u0a246 for activity org.liballeg.ex_ttf/org.liballeg.app.MainActivity
06-02 07:05:04.512  8778  8778 E SchedPolicy: open of /dev/cpuctl/bg_non_interactive/tasks failed: No such file or directory
06-02 07:05:04.521  8778  8778 I zygote  : Late-enabling -Xcheck:jni
06-02 07:05:04.658  8778  8778 D loadLibrary: allegro-debug
06-02 07:05:04.666  8778  8778 D loadLibrary: allegro_primitives-debug
06-02 07:05:04.667  8778  8778 D loadLibrary: allegro_image-debug
06-02 07:05:04.670  8778  8778 D loadLibrary: allegro_font-debug
06-02 07:05:04.672  8778  8778 D loadLibrary: allegro_ttf-debug
06-02 07:05:04.674  8778  8778 D loadLibrary: allegro_ttf
06-02 07:05:04.679  8778  8778 D loadLibrary: allegro_ttf FAILED
06-02 07:05:04.679  8778  8778 D loadLibrary: allegro_audio-debug
06-02 07:05:04.683  8778  8778 D loadLibrary: allegro_acodec-debug
06-02 07:05:04.687  8778  8778 D loadLibrary: allegro_color-debug
06-02 07:05:04.688  8778  8778 D loadLibrary: allegro_memfile-debug
06-02 07:05:04.691  8778  8778 D loadLibrary: allegro_physfs-debug
06-02 07:05:04.692  8778  8778 D loadLibrary: allegro_physfs
06-02 07:05:04.698  8778  8778 D loadLibrary: allegro_physfs FAILED
06-02 07:05:04.699  8778  8778 D loadLibrary: allegro_video-debug
06-02 07:05:04.703  8778  8778 D loadLibrary: allegro_video
06-02 07:05:04.705  8778  8778 D loadLibrary: allegro_video FAILED
06-02 07:05:04.708  8778  8778 D AllegroActivity: Number of input devices: 10
06-02 07:05:04.725  8778  8778 D AllegroActivity: onCreate
06-02 07:05:04.725  8778  8778 D AllegroActivity: Files Dir: /data/user/0/org.liballeg.ex_ttf/files
06-02 07:05:04.730  8778  8778 D AllegroActivity: External Storage Dir: /storage/emulated/0
06-02 07:05:04.733  8778  8778 D AllegroActivity: External Files Dir: /storage/emulated/0/Android/data/org.liballeg.ex_ttf/files
06-02 07:05:04.733  8778  8778 D AllegroActivity: external: avail = true writable = true
06-02 07:05:04.733  8778  8778 D AllegroActivity: sourceDir: /data/app/org.liballeg.ex_ttf-r_Zv9wp-k7Mcw1YhHvOJUw==/base.apk
06-02 07:05:04.734  8778  8778 D AllegroActivity: publicSourceDir: /data/app/org.liballeg.ex_ttf-r_Zv9wp-k7Mcw1YhHvOJUw==/base.apk
06-02 07:05:04.743  8778  8778 D AllegroActivity: before nativeOnCreate
06-02 07:05:04.747  8778  8778 I allegro : android  D 8778:     android_system.c:180  Java_org_liballeg_android_AllegroActivity_nativeOnCreate [   0.00000] entered nativeOnCreate
06-02 07:05:04.747  8778  8778 I allegro : android  D 8778:     android_system.c:188  Java_org_liballeg_android_AllegroActivity_nativeOnCreate [   0.00000] pthread_self:0xb6cc34a4
06-02 07:05:04.747  8778  8778 I allegro : android  D 8778:     android_system.c:189  Java_org_liballeg_android_AllegroActivity_nativeOnCreate [   0.00000] nativeOnCreate begin
06-02 07:05:04.747  8778  8778 I allegro : android  D 8778:     android_system.c:193  Java_org_liballeg_android_AllegroActivity_nativeOnCreate [   0.00000] grab activity global refs
06-02 07:05:04.747  8778  8778 I allegro : android  D 8778:     android_system.c:215  Java_org_liballeg_android_AllegroActivity_nativeOnCreate [   0.00000] create mutex and cond objects
06-02 07:05:04.747  8778  8778 I allegro : android  D 8778:     android_system.c:219  Java_org_liballeg_android_AllegroActivity_nativeOnCreate [   0.00000] get directories
06-02 07:05:04.748  8778  8778 I allegro : android  D 8778:     android_system.c:226  Java_org_liballeg_android_AllegroActivity_nativeOnCreate [   0.00000] resources_dir: /data/user/0/org.liballeg.ex_ttf/files
06-02 07:05:04.748  8778  8778 I allegro : android  D 8778:     android_system.c:227  Java_org_liballeg_android_AllegroActivity_nativeOnCreate [   0.00000] data_dir: /data/user/0/org.liballeg.ex_ttf/files
06-02 07:05:04.748  8778  8778 I allegro : android  D 8778:     android_system.c:228  Java_org_liballeg_android_AllegroActivity_nativeOnCreate [   0.00000] apk_path: /data/app/org.liballeg.ex_ttf-r_Zv9wp-k7Mcw1YhHvOJUw==/base.apk
06-02 07:05:04.748  8778  8778 I allegro : android  D 8778:     android_system.c:229  Java_org_liballeg_android_AllegroActivity_nativeOnCreate [   0.00000] model: Moto G (5) Plus
06-02 07:05:04.748  8778  8778 I allegro : android  D 8778:     android_system.c:230  Java_org_liballeg_android_AllegroActivity_nativeOnCreate [   0.00000] manufacturer: motorola
06-02 07:05:04.748  8778  8778 I allegro : android  D 8778:     android_system.c:232  Java_org_liballeg_android_AllegroActivity_nativeOnCreate [   0.00000] creating ALLEGRO_SYSTEM_ANDROID struct
06-02 07:05:04.748  8778  8778 I allegro : android  D 8778:     android_system.c:236  Java_org_liballeg_android_AllegroActivity_nativeOnCreate [   0.00000] get system pointer
06-02 07:05:04.748  8778  8778 I allegro : android  D 8778:     android_system.c:238  Java_org_liballeg_android_AllegroActivity_nativeOnCreate [   0.00000] get system interface
06-02 07:05:04.748  8778  8778 I allegro : android  D 8778:     android_system.c:241  Java_org_liballeg_android_AllegroActivity_nativeOnCreate [   0.00000] init display vector
06-02 07:05:04.748  8778  8778 I allegro : android  D 8778:     android_system.c:244  Java_org_liballeg_android_AllegroActivity_nativeOnCreate [   0.00000] init time
06-02 07:05:04.748  8778  8778 I allegro : android  D 8778:     android_system.c:248  Java_org_liballeg_android_AllegroActivity_nativeOnCreate [   0.00000] load user lib: libnative-lib.so
06-02 07:05:04.750  8778  8778 I allegro : android  E 8778:     android_system.c:251  Java_org_liballeg_android_AllegroActivity_nativeOnCreate [   0.00000] failed to load user lib: libnative-lib.so
06-02 07:05:04.750  8778  8778 I allegro : android  E 8778:     android_system.c:252  Java_org_liballeg_android_AllegroActivity_nativeOnCreate [   0.00000] dlopen failed: library "libfreetype.so" not found
06-02 07:05:04.755  8778  8778 D AllegroActivity: nativeOnCreate failed
06-02 07:05:04.906  8778  8778 D AllegroActivity: onDestroy
06-02 07:05:04.924  2745  2824 I ActivityManager: Process org.liballeg.ex_ttf (pid 8778) has died: cch  CEM 
06-02 07:05:04.924  2745  2796 W zygote  : kill(-8778, 9) failed: No such process
06-02 07:05:04.924  2745  2796 I zygote  : Successfully killed process cgroup uid 10246 pid 8778 in 0ms

Elias
Member #358
May 2000

In my Android builds (https://github.com/liballeg/android) I statically link freetype so the .so is not needed at runtime at all. Alternatively you can probably add the .so file and load it yourself.

You can see how I compile my version of freetype and allegro_ttf here: https://github.com/liballeg/android/blob/master/install_android.py

--
"Either help out or stop whining" - Evert

Pho75_
Member #12,377
November 2010

Elias:
Thank you! your tip helped me get the ball rolling.
See below for patches I had to apply to fix ex_ttf.

I had to compile freetype like so:

./configure --host $HOST --prefix $PREFIX --without-png --without-harfbuzz --with-zlib=no --with-bzip2=no

Also I didn't read README_android.txt carefully enough, I forgot to remove the version suffixes from the .so's.

But ex_ttf still needed several things to get it to work. After much googling:

1.
I had to manually copy dependency .so's to the jniLibs/armeabi-v7a folder for ex_ttf, which isn't being done for any of the examples.
I haven't figured out how to static compile the dependencies yet, so that this step isn't needed.

~/src/allegro5/build_android_armeabi-v7a/examples/ex_ttf.project/app/src/main/jniLibs/armeabi-v7a$ ls -l
total 14884
-rwxrwxr-x 1 u15392 u15392  166988 Jun  2 06:39 liballegro_acodec-debug.so
-rwxrwxr-x 1 u15392 u15392  166952 May 31 10:58 liballegro_acodec.so
-rwxrwxr-x 1 u15392 u15392  343428 Jun  2 06:39 liballegro_audio-debug.so
-rwxrwxr-x 1 u15392 u15392  334824 May 31 10:58 liballegro_audio.so
-rwxrwxr-x 1 u15392 u15392  133444 Jun  2 06:39 liballegro_color-debug.so
-rwxrwxr-x 1 u15392 u15392  146652 May 31 10:58 liballegro_color.so
-rwxrwxr-x 1 u15392 u15392 2791036 Jun  2 06:39 liballegro-debug.so
-rwxrwxr-x 1 u15392 u15392  202360 Jun  2 06:39 liballegro_font-debug.so
-rwxrwxr-x 1 u15392 u15392  214816 May 31 10:58 liballegro_font.so
-rwxrwxr-x 1 u15392 u15392  190356 Jun  2 06:39 liballegro_image-debug.so
-rwxrwxr-x 1 u15392 u15392  197380 May 31 10:58 liballegro_image.so
-rwxrwxr-x 1 u15392 u15392    6404 Jun  2 06:39 liballegro_main-debug.so
-rwxrwxr-x 1 u15392 u15392    6404 May 31 10:58 liballegro_main.so
-rwxrwxr-x 1 u15392 u15392  101772 Jun  2 06:39 liballegro_memfile-debug.so
-rwxrwxr-x 1 u15392 u15392  102640 May 31 10:58 liballegro_memfile.so
-rwxrwxr-x 1 u15392 u15392   38488 Jun  3 17:07 liballegro_physfs-debug.so
-rwxrwxr-x 1 u15392 u15392   42948 May 31 10:58 liballegro_physfs.so
-rwxrwxr-x 1 u15392 u15392  365840 Jun  2 06:39 liballegro_primitives-debug.so
-rwxrwxr-x 1 u15392 u15392  364880 May 31 10:58 liballegro_primitives.so
-rwxrwxr-x 1 u15392 u15392 2870680 May 31 10:58 liballegro.so
-rwxrwxr-x 1 u15392 u15392  152052 Jun  5 08:24 liballegro_ttf-debug.so
-rwxrwxr-x 1 u15392 u15392  153672 May 31 10:58 liballegro_ttf.so
-rwxr-xr-x 1 u15392 u15392  134208 Jun  5 08:22 libbrotlicommon.so
-rwxr-xr-x 1 u15392 u15392  166568 Jun  5 08:22 libbrotlidec.so
-rwxr-xr-x 1 u15392 u15392  961104 Jun  5 08:22 libbrotlienc.so
-rwxr-xr-x 1 u15392 u15392 1041488 Jun  5 08:22 libfreetype.so
-rw-r--r-- 1 u15392 u15392 3451764 Jun  5 08:22 libharfbuzz.so
-rwxrwxr-x 1 u15392 u15392   41972 Jun  5 15:29 libnative-lib.so
-rw-r--r-- 1 u15392 u15392  291284 Jun  5 08:22 libphysfs.so

2.
ex_ttf depends on examples/data/icon.png which is missing in the apk, so a patch to Allegro5 is needed:

diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index a514d5247..3878953dd 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -58,6 +58,7 @@ set(DATA_IMAGES
     font.tga
     gradient1.bmp
     haiku/air_effect.png
+    icon.png
     icon.tga
     mysha.pcx
     mysha256x256.png
@@ -217,7 +218,7 @@ example(ex_logo ${FONT} ${TTF} ${IMAGE} ${PRIM} DATA ${DATA_TTF})
 example(ex_projection ${TTF} ${IMAGE} ${DATA_IMAGES} ${DATA_TTF})
 example(ex_projection2 ${PRIM} ${FONT} ${IMAGE} ${DATA_IMAGES})
 example(ex_camera ${FONT} ${COLOR} ${PRIM} ${IMAGE})
-example(ex_ttf ${TTF} ${PRIM} ${IMAGE} DATA ${DATA_TTF} ex_ttf.ini)
+example(ex_ttf ${TTF} ${PRIM} ${IMAGE} ${DATA_IMAGES} ${DATA_TTF} ex_ttf.ini)

3.
Allegro was still failing to open icon.png once it's in the apk.
So another patch is needed to the gradle project to not compress the data files inside the apk.
These were the file extensions I found in the examples folder, i'm not sure it's complete (demos, etc.), or accurate, since I don't know which file-types the allegro file interface will choke on.

diff --git a/android/gradle_project/app/build.gradle b/android/gradle_project/app/build.gradle
index d738cd030..e0826e342 100644
--- a/android/gradle_project/app/build.gradle
+++ b/android/gradle_project/app/build.gradle
@@ -14,6 +14,9 @@ android {
             minifyEnabled false
         }
     }
+    aaptOptions {
+        noCompress 'bmp', 'cfg', 'dds','fnt','jpg','ogg','pcx','png','tga','ttf','voc','wav','webp','zip'
+    }
 }
 
 dependencies {

But at least ex_ttf is building and running now on my android phone.

TODO:
-figure out how to static compile Allegro5 dependencies for android.
-submit patches to Allegro5

Go to: