Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't setup allegro for android #1

Closed
dhiahassen opened this issue Oct 12, 2016 · 14 comments
Closed

Can't setup allegro for android #1

dhiahassen opened this issue Oct 12, 2016 · 14 comments

Comments

@dhiahassen
Copy link

dhiahassen commented Oct 12, 2016

i folowed thr given steps but it is not working , got :

Error:executing external native build for cmake D:\Dev\AndroidStudioProjects\MyApplication4\app\CMakeLists.txt

and

Error:(37, 13) Failed to resolve: org.liballeg:allegro5-release:5.2.0.0

note : i didnt excute install_android.py because i got an error message "missing args" , tell me exacly how to do it , and what does your build system expect me to have

do i have to download allegro from the github first ? you told me on the forum that i dont need to download anything !

@elias-pschernig
Copy link
Member

Which version of Android Studio are you using? This can only work with 2.2 or newer. Also, you need to check "C++ support" when creating your project. (You do not need install_android.py - that's to compile Allegro itself.)

@elias-pschernig
Copy link
Member

Actually - it seems the package is missing from jcenter - let me investigate.

@elias-pschernig
Copy link
Member

Oh, the version is 5.2.2.0 - not 5.2.0.0. Sorry about that.

@dhiahassen
Copy link
Author

dhiahassen commented Oct 12, 2016

i have android studio 2.2 , now it downloaded the library but i have new errors :
include could not find load file:
build/intermediates/exploded-aar/org.liballeg/allegro5-release/5.2.2.0/assets/allegro.cmake
Error:executing external native build for cmake D:\Dev\AndroidStudioProjects\MyApplication4\app\CMakeLists.txt

Under " build/intermediates/" the folder "/exploded-aar" is not there

@dhiahassen
Copy link
Author

oh i have to change the version on Cmake file too hh , wait ill create new project

@dhiahassen
Copy link
Author

dhiahassen commented Oct 12, 2016

now i have this :
External Native Build Issues Build command failed. Error while executing 'D:\Dev\AndroidSDK\cmake\3.6.3155560\bin\cmake.exe' with arguments {-HD:\Dev\AndroidStudioProjects\MyApplication5\app -BD:\Dev\AndroidStudioProjects\MyApplication5\app\.externalNativeBuild\cmake\debug\armeabi -GAndroid Gradle - Ninja -DANDROID_ABI=armeabi -DANDROID_NDK=D:\Dev\android-ndk-r13-windows-x86_64\android-ndk-r13 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=D:\Dev\AndroidStudioProjects\MyApplication5\app\.externalNativeBuild\cmake\debug\obj\armeabi -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=D:\Dev\AndroidSDK\cmake\3.6.3155560\bin\ninja.exe -DCMAKE_TOOLCHAIN_FILE=D:\Dev\android-ndk-r13-windows-x86_64\android-ndk-r13\build\cmake\android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=15 -DCMAKE_CXX_FLAGS=-frtti -fexceptions} -- Check for working C compiler: D:/Dev/android-ndk-r13-windows-x86_64/android-ndk-r13/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- Check for working C compiler: D:/Dev/android-ndk-r13-windows-x86_64/android-ndk-r13/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: D:/Dev/android-ndk-r13-windows-x86_64/android-ndk-r13/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -- Check for working CXX compiler: D:/Dev/android-ndk-r13-windows-x86_64/android-ndk-r13/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring incomplete, errors occurred! See also "D:/Dev/AndroidStudioProjects/MyApplication5/app/.externalNativeBuild/cmake/debug/armeabi/CMakeFiles/CMakeOutput.log". CMake Error at CMakeLists.txt:47 (include): include could not find load file: build/intermediates/exploded-aar/org.liballeg/allegro5-release/5.2.2.0/assets/allegro.cmake Error:executing external native build for cmake D:\Dev\AndroidStudioProjects\MyApplication5\app\CMakeLists.txt Build command failed. Error while executing 'D:\Dev\AndroidSDK\cmake\3.6.3155560\bin\cmake.exe' with arguments {-HD:\Dev\AndroidStudioProjects\MyApplication5\app -BD:\Dev\AndroidStudioProjects\MyApplication5\app\.externalNativeBuild\cmake\release\armeabi -GAndroid Gradle - Ninja -DANDROID_ABI=armeabi -DANDROID_NDK=D:\Dev\android-ndk-r13-windows-x86_64\android-ndk-r13 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=D:\Dev\AndroidStudioProjects\MyApplication5\app\.externalNativeBuild\cmake\release\obj\armeabi -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=D:\Dev\AndroidSDK\cmake\3.6.3155560\bin\ninja.exe -DCMAKE_TOOLCHAIN_FILE=D:\Dev\android-ndk-r13-windows-x86_64\android-ndk-r13\build\cmake\android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=15 -DCMAKE_CXX_FLAGS=-frtti -fexceptions} -- Check for working C compiler: D:/Dev/android-ndk-r13-windows-x86_64/android-ndk-r13/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- Check for working C compiler: D:/Dev/android-ndk-r13-windows-x86_64/android-ndk-r13/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: D:/Dev/android-ndk-r13-windows-x86_64/android-ndk-r13/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -- Check for working CXX compiler: D:/Dev/android-ndk-r13-windows-x86_64/android-ndk-r13/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring incomplete, errors occurred! See also "D:/Dev/AndroidStudioProjects/MyApplication5/app/.externalNativeBuild/cmake/release/armeabi/CMakeFiles/CMakeOutput.log". CMake Error at CMakeLists.txt:47 (include): include could not find load file: build/intermediates/exploded-aar/org.liballeg/allegro5-release/5.2.2.0/assets/allegro.cmake Error:executing external native build for cmake D:\Dev\AndroidStudioProjects\MyApplication5\app\CMakeLists.txt

@elias-pschernig
Copy link
Member

Hm, it can't find app/build/intermediates/exploded-aar/org.liballeg/allegro5-release/5.2.2.0/assets/allegro.cmake.

I wonder if there is a way to tell Android-Studio to unpack it before running cmake.

Can you remove the include line from your CMakeLists.txt and build? Then after it is done and the .aar is unpacked, add the line back in and build again.

Anyway, we clearly need a better solution than the assets folder. I might just have to distribute the allegro.cmake separately and ask to put it next to the CMakeLists.txt...

@dhiahassen
Copy link
Author

finnaly it is there ( the extracted folder ) now i have : Error:(3, 10) fatal error: 'allegro5/allegro_native_dialog.h' file not found

@dhiahassen
Copy link
Author

i don't know how to add the include path , even on the web no answer

@elias-pschernig
Copy link
Member

You can look at app/build/intermediates/exploded-aar/org.liballeg/allegro5-release/5.2.2.0/assets/allegro.cmake - it sets up the include path. Maybe just copy that file next to the normal CMakeLists.txt and include it (or just paste the contents into the main CMakeLists.txt).

I'm waiting for Google to release some guidelines how to distribute C++ header files - right now there is nothing yet. I think for now I'll upload a separate .zip which has the .jar with the libraries, and another .zip which has the allegro.cmake and the headers. (All those files are in the .aar file right now.)

The unfortunate side effect is that we can't distribute those on jcenter, so it is more steps having to unpack those zips and place the files somewhere.

@elias-pschernig
Copy link
Member

elias-pschernig commented Oct 14, 2016

The workaround I added to the readme seems to work for me btw. - so if you just want to get it to work, that should be the easiest way, even if it's a bit stupid :P

@dhiahassen
Copy link
Author

There is something very stupid about this build method , all of allegro's includes files can be found on the apk , they take extra space , now the the apk size is 8.16MB !!! this is an empty app , add to that it still crashes on startup , ill stick with sdl for the moment hh

@elias-pschernig
Copy link
Member

So it finally worked? That's good news!

And those 8.16 MB include the Allegro libraries for 7 architectures as well - the include files actually take very little space. You can exclude architectures you don't want from your app/build.gradle - for example:

abiFilters "x86", "x86_64", "armeabi-v7a"

By default Android Studio always compiles your C++ code for 7 architectures though (and then you would want Allegro for all 7 as well).

I don't actually know if the filter only prevents compiling your game's C++ code or if also removes prebuilt libraries from the .apk - so it may not help much with the size. You can always unpack the .aar file and remove the libraries for unwanted architectures and place the headers outside the assets folder though.

@dhiahassen
Copy link
Author

yeah i know about that , plz try to write a manifest xml file that creates an Opengl ES activity like sdl2 does

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants