Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Building 5.2.2.0 for Android

This thread is locked; no one can reply to it. rss feed Print
Building 5.2.2.0 for Android
amarillion
Member #940
January 2001
avatar

I'm trying to make the leap to android. I'm trying to follow along the guide here:
https://wiki.allegro.cc/index.php?title=Running_Allegro_applications_on_Android

I'm getting to the point of actually compiling allegro for android. I've got allegro checked out from git on the 5.2.2.0 tag. Then, following the guide, I do:

mkdir Build/Android
cd Build/Android
cmake ../.. -DANDROID_NDK_TOOLCHAIN_ROOT=$TC -DWANT_ANDROID=on -DCMAKE_BUILD_TYPE=Debug -DANDROID_TARGET=android-15

After running that I get the following warnings:

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

    ANDROID_NDK_TOOLCHAIN_ROOT
    ANDROID_TARGET
    WANT_ANDROID

What am I missing here? Any idea why it is not recognizing the specified variables?

edit: looks like the wiki is out of date. SiegeLord pointed me to the readme. ANDROID_NDK_TOOLCHAIN_ROOT should be specified as an environment variable, and the WANT_ANDROID is replaced with a reference to the Android toolchain. So this works:

ANDROID_NDK_TOOLCHAIN_ROOT=$TC cmake ../.. -DCMAKE_TOOLCHAIN_FILE=../../cmake/Toolchain-android.cmake  -DCMAKE_BUILD_TYPE=Debug -DANDROID_TARGET=android-15
make

But then I run into the next problem:

#SelectExpand
1[ 8%] Built target allegro_main 2Scanning dependencies of target jar 3[ 8%] Generating allegro_activity/AndroidManifest.xml, allegro_activity/build.xml 4[ 8%] Generating allegro_activity/local.properties
5**********************************************************************
6The "android" command is deprecated. 7For manual SDK, AVD, and project management, please use Android Studio. 8For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
9**********************************************************************
10Invalid or unsupported command "update project -p . -t android-15" 11 12Supported commands are: 13android list target 14android list avd 15android list device 16android create avd 17android move avd 18android delete avd 19android list sdk 20android update sdk 21android/CMakeFiles/jar.dir/build.make:74: recipe for target 'android/allegro_activity/local.properties' failed 22make[2]: *** [android/allegro_activity/local.properties] Error 2 23CMakeFiles/Makefile2:648: recipe for target 'android/CMakeFiles/jar.dir/all' failed 24make[1]: *** [android/CMakeFiles/jar.dir/all] Error 2 25Makefile:127: recipe for target 'all' failed 26make: *** [all] Error 2

Polybios
Member #12,293
October 2010

You can also use this to build Allegro apps with Android Studio. It worked for me.

amarillion
Member #940
January 2001
avatar

I'll give that a try. It looks like the instructions in the android readme assume older tools that are now deprecated.

edit:

Ok, I got it working! At least I have now a HelloWorld app running in a virtual android device. Thanks Elias!

I still believe it's worth updating the android README if somebody knows how to get it compiling with a more recent toolchain. Or give instructions on how to install an older toolchain. And update the wiki. I would do it myself if I knew what the correct procedure is.

Elias
Member #358
May 2000

The wiki is read only unfortunately.

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

GullRaDriel
Member #3,861
September 2003
avatar

Who owns the wiki admin ? If it's Gideon, he asked for help on it. Or maybe Thomas ?

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Elias
Member #358
May 2000

For what it's worth, if you want to compile yourself for some reason (to fix a bug!) here's a guide that works. To build for architectures other than armeabi-v7a, repeat all steps except use one of armeabi, x86, x86_64, arm64-v8a, mips, mips64 instead.

Install JDK and Linux SDK+NDK

Compile Freetype

Compile Ogg

Compile Vorbis

Compile Allegro

  • mkdir build-android-armeabi-v7a

  • cd build-android-armeabi-v7a

  • cmake ../allegro -DCMAKE_TOOLCHAIN_FILE=../allegro/cmake/Toolchain-android.cmake -DARM_TARGETS=armeabi-v7a -DCMAKE_BUILD_TYPE=Release -DANDROID_TARGET=android-24 -DWANT_DEMO=off -DWANT_EXAMPLES=off -DWANT_TESTS=off -DWANT_DOCS=off -DPKG_CONFIG_EXECUTABLE=/usr/bin/pkg-config -DOGG_LIBRARY=toolchain-armeabi-v7a/lib/libogg.a -DOGG_INCLUDE_DIR=toolchain-armeabi-v7a/include -DVORBIS_LIBRARY=toolchain-armeabi-v7a/lib/libvorbis.a -DVORBISFILE_LIBRARY=toolchain-armeabi-v7a/lib/libvorbisfile.a -DVORBIS_INCLUDE_DIR=toolchain-armeabi-v7a/include -DSUPPORT_VORBIS=true -DFREETYPE_LIBRARY=toolchain-armeabi-v7a/lib/libfreetype.a -DFREETYPE_INCLUDE_DIRS=toolchain-armeabi-v7a/include;toolchain-armeabi-v7a/include/freetype2

  • make

  • make install

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

Go to: