|
Initial Android port committed to subversion |
Thomas Fjellstrom
Member #476
June 2000
|
I just committed the android port to Allegro 5's subversion repo. What is done, works fine. What isn't done, doesn't work at all. Basically a single display at a time, with touch and key events, is all that is done right now. That leaves file system access, apk package access, sound, accelerometer (some of the code for this is already done), camera access, some cleanup, and a bunch of tweaks to polish it up. Those wanting to try out the new port, fetch and build Allegro 5.1 from subversion and let me know how it goes I expect problems, so don't hesitate to tell me about them. -- |
AMCerasoli
Member #11,955
May 2010
|
Ohhh.. And what's this? Our Christmas gift?, thank you Thomas, I didn't bring anything, if I had known I would bring some chocolates or something. Do you like Panettone?, I have some of it in the car... I don't have any phone to test it right now but I'll talk with some friends to see if I can borrow a phone some days. Thanks.
|
Elias
Member #358
May 2000
|
I'm too busy with Santahack right now to try it, but this is awesome news. {"name":"605236","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/0\/6\/06f324ef73229b8d03e1e3694998ab28.png","w":256,"h":256,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/0\/6\/06f324ef73229b8d03e1e3694998ab28"} -- |
AMCerasoli
Member #11,955
May 2010
|
Wait wait.. I want to also give him a gift... Put some color in your life... {"name":"605237","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/1\/c1ed7ec72a7ac3853291ff37fea62665.png","w":414,"h":415,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/1\/c1ed7ec72a7ac3853291ff37fea62665"}
|
Trent Gamblin
Member #261
April 2000
|
I might try this later today if I ever wake up.
|
kenmasters1976
Member #8,794
July 2007
|
Sounds great!. I don't have an Android phone but I know a few people who does so I'm looking forward to try this one. Setting up the Android development environment is going to be the hardest part. A wiki page for it would be nice.
|
kazzmir
Member #1,786
December 2001
|
Compilation fails when it gets to the opengl stuff /opt/android/arm-linux-androideabi-4.4.3/bin/arm-linux-androideabi-gcc -Dallegro_EXPORTS -fPIC -DANDROID -mthumb -Wno-psabi -march=armv7-a -mfloat-abi=softfp -W -Wall -O2 -g -fPIC -I/opt/android/arm-linux-androideabi-4.4.3/arm-linux-androideabi/include/c++/4.4.3/arm-linux-androideabi -I/home/jon/svn/allegro/5.1/include -I/home/jon/svn/allegro/5.1/b/include -DALLEGRO_SRC -DALLEGRO_LIB_BUILD -o CMakeFiles/allegro.dir/src/opengl/extensions.c.o -c /home/jon/svn/allegro/5.1/src/opengl/extensions.c In file included from /home/jon/svn/allegro/5.1/src/opengl/extensions.c:22: /home/jon/svn/allegro/5.1/include/allegro5/allegro_opengl.h:70:21: error: GLES/gl.h: No such file or directory On my system I installed the standalone toolchain to /opt/android/arm-linux-android-eabi-4.4.3. The ndk is extracted to /opt/android. As far as I can tell GLES/gl.h only lives in /opt/android/platforms/android-4/arch-arm/usr/include/GLES/gl.h so -I/opt/android/platforms/android-4/arch-arm/usr/include would have to be added to the compilation line. Does Cmake expect opengl stuff to be in the standalone toolchain? <edit> I ran the test application from android-project on my galaxy pad. I had to hack the makefiles and stuff to not use liballegro-debug.so but rather just liballegro.so. The test application shows a white box that you can touch and move around red boxes. I was able to press all 10 of my fingers and have 10 boxes show up! |
Trent Gamblin
Member #261
April 2000
|
I got it compiled on Windows and running on my old Android 1.6 device with a bunch of changes. When I get more time I can help rejig the build system so it'll support different platforms easily. The example runs, right now the screen flickers a lot and the squares leave trails, but that is probably something simple, I hope, like Vsync being off.
|
Thomas Fjellstrom
Member #476
June 2000
|
Trent Gamblin said: When I get more time I can help rejig the build system so it'll support different platforms easily. It shouldn't take too much work. The Toolchain-android.cmake file just needs a couple more variables. Also it is not a standard CMAKE_TOOLCHAIN_FILE file. I tried to make it one of those, but the code that was needed does some stuff that doesn't work in a CMAKE_TOOLCHAIN_FILE file. Apparently toolchain files are included more than once in a run, and at least one of the times, its given an EMPTY environment, but its never the first pass. So its completely borked as a CMAKE_TOOLCHAIN_FILE file. Could probably just get rid of that file and stick it all in the main cmake file. Quote: The example runs, right now the screen flickers a lot and the squares leave trails, but that is probably something simple, I hope, like Vsync being off. Very possible. I just went as far as getting graphics up, and the flicker doesn't happen on the nexus s, so I didn't know it happened at all, otherwise I'd have fixed it :-x -- |
BAF
Member #2,981
December 2002
|
You didn't test with the emulator? Surely that would give a nice, slower environment to test in. |
Thomas Fjellstrom
Member #476
June 2000
|
BAF said: You didn't test with the emulator? Surely that would give a nice, slower environment to test in. I'm not sure the emulator supports all the stuff we're using. I don't really care if it works in the emulator, I care if it works on actual devices, so that's what (I) we test with. You're welcome to try it if you like, but I have my doubts as to its usefulness. -- |
J-Gamer
Member #12,491
January 2011
|
While trying to compile for Android 2.2(API 8), I got this error: EDIT: " There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo |
Trent Gamblin
Member #261
April 2000
|
You need to remove the options that aren't supported by your OS. You'll need to find the docs on that, I found them with a google search. They'll mention "available on OS version XX" or something like that if they're additions. Then edit the java file and comment out the lines pertaining to those elements you removed from the configChanges option. It should give you errors with line numbers, but the lines will begin with lines similar to the ones you remove "..SCREEN_SIZE" etc.
|
J-Gamer
Member #12,491
January 2011
|
So it is safe to remove them... ok EDIT: EDIT2: EDIT3: " There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo |
Thomas Fjellstrom
Member #476
June 2000
|
Did you copy the allegro libraries into the jni dir? And since you didn't use the debug version, you need to edit AllegroActivity.java to load the regular lib rather than debug. As for the configChanges option, I "Fixed" that by targeting Android 4.0, it runs fine on 2.3.4, I just don't get those events that came with 4.0. -- |
J-Gamer
Member #12,491
January 2011
|
liballegro.so and liballegro_primitives.so are in the jni/armeabi-v7a folder. static { /* FIXME: see if we can't load the allegro library name, or type from the manifest here */ System.loadLibrary("allegro"); System.loadLibrary("allegro_primitives"); } But it still crashes... EDIT: " There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo |
Thomas Fjellstrom
Member #476
June 2000
|
Is it crashing, or not compiling? Crashing leads me to believe its actually compiling. Sadly without the debug version of allegro, we can't see any decent logs from 'adb logcat'. If/when you build a debug version of allegro, and the app (ant debug), please run 'adb logcat' before launching the app, and let it continue to run till after the crash. then post the log here But that stackoverflow solution is basically what I did. Changed the target to the 4.0 sdk, and things just work, even on 2.3.4. -- |
J-Gamer
Member #12,491
January 2011
|
Is building the debug version an option in cmake? It crashes as soon as I try to start it. It gives a black screen with the slide bar up top and the name AllegroActivity(haven't bothered changing the program name yet). Then it complains that the application needs to be force-closed. " There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo |
AMCerasoli
Member #11,955
May 2010
|
Quote: then post the log here no no... What Thomas wanted to say was: "then post the log here "
|
Thomas Fjellstrom
Member #476
June 2000
|
Yeah, change the CMAKE_BUILD_TYPE to "Debug". J-Gamer said: It crashes as soon as I try to start it. It gives a black screen with the slide bar up top and the name AllegroActivity(haven't bothered changing the program name yet). Then it complains that the application needs to be force-closed. If it's not compiling, that'll just be an old version of the lib. Also you need to uninstall the previously installed version before it lets you install a new one. Its incredibly annoying. But I won't know whats causing it for sure till I see the logs. -- |
Trent Gamblin
Member #261
April 2000
|
Try running with logcat. In one terminal run 'adb logcat', what for it to spew out its messages, then in another terminal use the adb -d shell command from the readme to run the app manually. The logcat window will print a ton of debug info. In my case it narrowed the problem down.
|
J-Gamer
Member #12,491
January 2011
|
It outputs a whole list of error messages, but it doesn't seem to be able to find allegro-debug... shouldn't that be liballegro-debug? EDIT: tried renaming the lib files, to no avail. 1I/ActivityManager( 165): Starting activity: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.comuf.jgames/.AllegroActivity }
2I/ActivityManager( 165): Start proc com.comuf.jgames for activity com.comuf.jgames/.AllegroActivity: pid=15768 uid=10105 gids={}
3I/WindowManager( 165): force=true top=null
4V/WindowManager( 165): finishLayoutLw::mHideKeyguard=false
5W/dalvikvm(15768): Exception Ljava/lang/UnsatisfiedLinkError; thrown during Lcom/comuf/jgames/AllegroActivity;.<clinit>
6W/dalvikvm(15768): Class init failed in newInstance call (Lcom/comuf/jgames/AllegroActivity;)
7W/dalvikvm(15768): threadid=1: thread exiting with uncaught exception (group=0x400207d8)
8E/AndroidRuntime(15768): FATAL EXCEPTION: main
9E/AndroidRuntime(15768): java.lang.ExceptionInInitializerError
10E/AndroidRuntime(15768): at java.lang.Class.newInstanceImpl(Native Method)
11E/AndroidRuntime(15768): at java.lang.Class.newInstance(Class.java:1429)
12E/AndroidRuntime(15768): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
13E/AndroidRuntime(15768): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2578)
14E/AndroidRuntime(15768): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2680)
15E/AndroidRuntime(15768): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
16E/AndroidRuntime(15768): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
17E/AndroidRuntime(15768): at android.os.Handler.dispatchMessage(Handler.java:99)
18E/AndroidRuntime(15768): at android.os.Looper.loop(Looper.java:123)
19E/AndroidRuntime(15768): at android.app.ActivityThread.main(ActivityThread.java:4628)
20E/AndroidRuntime(15768): at java.lang.reflect.Method.invokeNative(Native Method)
21E/AndroidRuntime(15768): at java.lang.reflect.Method.invoke(Method.java:521)
22E/AndroidRuntime(15768): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
23E/AndroidRuntime(15768): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
24E/AndroidRuntime(15768): at dalvik.system.NativeStart.main(Native Method)
25E/AndroidRuntime(15768): Caused by: java.lang.UnsatisfiedLinkError: Library allegro-debug not found
26E/AndroidRuntime(15768): at java.lang.Runtime.loadLibrary(Runtime.java:461)
27E/AndroidRuntime(15768): at java.lang.System.loadLibrary(System.java:557)
28E/AndroidRuntime(15768): at com.comuf.jgames.AllegroActivity.<clinit>(AllegroActivity.java:73)
29E/AndroidRuntime(15768): ... 15 more
30W/ActivityManager( 165): Force finishing activity com.comuf.jgames/.AllegroActivity
31I/WindowManager( 165): force=true top=null
32V/WindowManager( 165): finishLayoutLw::mHideKeyguard=false
33I/WindowManager( 165): force=true top=null
34V/WindowManager( 165): finishLayoutLw::mHideKeyguard=false
35I/ActivityManager( 165): Process com.comuf.jgames (pid 15768) has died.
36I/UsageStats( 165): Something wrong here, didn't expect com.sec.android.app.twlauncher to be paused
37I/WindowManager( 165): force=true top=Window{45514260 com.sec.android.app.twlauncher/com.sec.android.app.twlauncher.Launcher paused=false}
38V/WindowManager( 165): finishLayoutLw::mHideKeyguard=false
39I/WindowManager( 165): force=true top=Window{45514260 com.sec.android.app.twlauncher/com.sec.android.app.twlauncher.Launcher paused=false}
40V/WindowManager( 165): finishLayoutLw::mHideKeyguard=false
41D/Launcher(11543): launcher is resumed
42E/MTP-LAUNCHER(11543): media scanning not yet finished.
43D/Launcher(11543): launcher is paused
44D/BatteryService( 165): update start
45D/BatteryService( 165): update start
46D/BatteryService( 165): update start
47I/ActivityThread(11543): queueIdle
48V/ActivityThread(11543): Reporting idle of ActivityRecord{4503dbc8 token=android.os.BinderProxy@4503d558 {com.sec.android.app.twlauncher/com.sec.android.app.twlauncher.Launcher}} finished=false
49W/ActivityNative(11543): send ACTIVITY_IDLE_TRANSACTION
50W/ActivityNative( 165): RCV ACTIVITY_IDLE_TRANSACTION
51D/BatteryService( 165): update start
52D/BatteryService( 165): update start
53D/BatteryService( 165): update start
" There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo |
Thomas Fjellstrom
Member #476
June 2000
|
J-Gamer said: It outputs a whole list of error messages, but it doesn't seem to be able to find allegro-debug... shouldn't that be liballegro-debug? It strips off the lib part. But that is the error all right, it can't find the allegro library. You absolutely sure you've coppied the liballegro-debug.so library into the jni/armeabi-v7a dir, and that you've fully uninstalled, rebuilt, and installed your app? -- |
J-Gamer
Member #12,491
January 2011
|
Yes. Unless the removal trough settings->applications is incomplete... I wouldn't know how else to fully remove an app. " There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo |
Thomas Fjellstrom
Member #476
June 2000
|
Ok, that should work. I've had similar issues in the past, where it just wouldn't recognize a change for some reason. Try 'ant clean', and 'ant debug' again. then see if it won't install and run. Oh hey, also make sure you've changed the Java_ function names in the android_system.c and android_display.c files to match your new package name. I forgot to put that in the README. It shouldn't cause this error, rather it'd cause a different unsatisfied link error mentioning symbols couldn't be found. -- |
|
|